Delete option values in select block in HTML with Javascript -


i need delete option value tags inside select elements this:

     <select name="name">   <option value="something1">first</option>  <option value="something2">second</option>       </select> 

so need find way delete value="something" javascript, end :

     <select name="name">   <option>first</option>  <option>second</option>       </select> 

how javascript?

find options using queryselectorall

to remove attribute use removeattribute

	var options = document.queryselectorall('[name="name"] option');  	for (var = 0, ilen = options.length; < ilen; i++) {  	  options[i].removeattribute('value');  	}
<select name="name">    <option value="something1">first</option>    <option value="something2">second</option>  </select>


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -