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

java - unable show chart in xls document using jasper reports -

javascript - How to change image src on success AJAX -

java.lang.RuntimeException: Could not generate dummy secret at sun.security.ssl.RSAClientKeyExchange.<init> -