I'm aware that jQuery's change()
method doesn't fire for select and radio inputs in IE9. However, none of the workarounds I've found are working for me.
Here's the code that works in all decent browsers:
$("select#orderby").change( function(e){
console.log("order");
$("#candidate-filters").submit();
});
Here's a version of what I see people doing to get around this problem in IE9:
$("select#orderby").bind( ($.browser.msie)? 'propertychange' : 'change', function(e){
console.log("order");
$("#candidate-filters").submit();
});
This doesn't work when I try it. No errors in the console. Just nothing happens. What am I doing wrong?
EDIT: When I switch to the .on()
method I can cause the page to reload (presumably as a result of the .submit()
action) but the form select input isn't captured. The page simply reloads as if nothing was changed.
IT WORKS! But there was one other part that I overlooked which others might find useful. IE doesn't support the HTML5 form="form_id"
attribute which lets you place a an form element outside of the <form>
tags. So once I was able to bind the event, I also had to had to append the value into the form:
if ($.browser.msie) {
$("select#orderby").bind( "propertychange", function(e){
//console.log("order");
var update = $(this).val();
$("#candidate-filters").append('<input type="hidden" name="orderby" value="'+ update +'" /> ');
$("#candidate-filters").submit();
});
} else {
$("select#orderby").change( function(e){
console.log("order");
$("#candidate-filters").submit();
});
}
I SPOKE TOO SOON: The code above only works in IE8 but not IE9. Any ideas?