简体   繁体   中英

Onclick event not working over <option> tag in IE 11

<select class="form-control" id="list7" onblur="document.getElementById('lista7').selectedIndex = -1;" size="30" class="form-control" style="height: 350px !important;">
   <option onclick="alert('aa');return false;" value="" data-toggle="modal" data-target="#myModal" style="font-size: 0.69em;">10325894 DGR STD (5)</option>
</select>

This is the code, onClick over an option it should pop an alert, and then show a modal, but is doing nothing and the IE console does not fire anything, this code its working right in chrome!

The onclick procedure should belong to the Select element - then you pick up the selected option with SelectBox.SelectedIndex... (something like that - look it up)

As far as I know that should then work cross-browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM