jquery - Disable all the <select> items in JavaScript -


i have few <select>s items in jsp file, want disable <select>s items.

this jsp file:

<select id="combosupergrupos1" name="combossupg">     <option value="0">n...</option>     <!-- x options --> </select>  <select id="combosupergrupos2" name="combossupg">     <option value="0">n...</option>     <!-- x options --> </select> 

this i'm trying:

var combossupergrupo = document.getelementsbyname("combossupg"); combossupergrupo.disabled = true; 

but can't achieve goal. i'm thinking jquery, don't know if can mix javascript jquery.

any question post on comments.

jquery :

$('select[name="combossupg"]').attr('disabled',true); 

javascript :

var selects = document.queryselectorall("select[name='combossupg']"); selects.foreach(function(s){     s.disabled = true; }); 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -