option & jQuery .click() won't work together
- by meow
Hello,
this works great in FF but not in IE, Chrome or Safari.
$('#countryDropDown option').click(function() {
var countryID = $(this).val();
dostuff();
});
// countryDropDown = id of select
So, as you can see I want to attach a click event to each option.
I alos tried
var allOpts = $('#countryDropDown option'),
l = allOpts.length,
i = 0;
for (i = 0; i < l; i += 1) {
$(allOpts[i]).click(function() {
var countryID = $(this).val();
doStuff();
});
}
It still does not want to work in any other browser but FF. What am I doing wrong?
Thanks