javascript - Set Evenet Listener on Selectobox is disabled(DOMAttrModified) -


i set event listener on selectbox should triggerd while attribute changed disabled. tryed following:

<select id="a">     <option>heino</option>     <option>michael jackson</option>     <option>tom waits</option>     <option>nina hagen</option>     <option>marianne rosenberg</option> </select> <button id="b">action</button> <script type="text/javascript"> var = document.getelementbyid("a"); a.addeventlistener('domattrmodified', function() {     alert(0); }, false);  var b = document.getelementbyid("b"); b.onclick = function() {     a.setattribute('disabled', 'disabled'); }; </script> 

by changing disabled attribute attribute example working fine. have idea trigger event? solution browsers nice.

thanks

with a.setattribute('disabled', 'disabled') disable <select> , not specific <option>. if want disable selected option if click button:

var b = document.getelementbyid("b"); b.onclick = function () {     (var = 0; < a.length; += 1) {         if (a[i].selected == true) {             a[i].setattribute('disabled', 'disabled');         }     } }; 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -