Created
February 9, 2011 20:57
-
-
Save jasonmcleod/819260 to your computer and use it in GitHub Desktop.
Bind events to select > option. Even in IE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // IE won't recognize events bound to multi-select options (or any <option> tag for that matter) | |
| // This is how I worked around that issue (for multi select , I'm afraid it fails on standard select menus.) | |
| $("#radicalMultiSelectMenu option").live("click-option",function() { | |
| // code I would have put in live("click") if IE wasn't a bastard. | |
| // instead, I just created a custom event called click-option. | |
| console.log(this); | |
| }); | |
| $("#radicalMultiSelectMenu").live("click",function() { | |
| $(this).find("option:selected").trigger("click-option"); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment