I have some html code
<div class="filters-widget bordered">
<span class="checkbox" style="background-position: 0px 0px; "></span><input type="checkbox" id="sidecity-control-name-2" name="sidecity" class="styled" value="Brisbane">
<label for="sidecity-control-name-2">Brisbane (109)</label>
</div>
And I have this js code
$(document).ready(
function () {
registerClick();
function formSubmit() {
this.document.getElementById("filters-form").submit();
}
function registerClick() {
$('.filters-widget.bordered input[type="checkbox"]').bind("click", function () {
formSubmit();
});
$('.filters-widget.bordered span[class="checkbox"]').live("click", function () {
formSubmit();
});
$('.filters-widget.bordered label').bind("mousedown", function () {
var id = $(this).prop("for");
var span = document.getElementById(id).previousSibling;
Custom.pushed.call(span);
});
};
});
I use jQuery 1.6.1.
In IE8 this part of code don’t work
$('.filters-widget.bordered input[type="checkbox"]').bind("click", function () {
formSubmit();
});
The function is not called.
How to resolve this problem ?
A check box does not have a click event. This has nothing todo with jQuery.
Instead of
clickyou can usechange:See the jQuery reference:
http://api.jquery.com/change/