Skip to content

Instantly share code, notes, and snippets.

@jasonmcleod
Created February 9, 2011 20:57
Show Gist options
  • Select an option

  • Save jasonmcleod/819260 to your computer and use it in GitHub Desktop.

Select an option

Save jasonmcleod/819260 to your computer and use it in GitHub Desktop.
Bind events to select > option. Even in IE
// 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