I’m trying to bind some click events with jQuery. Everything works in Chrome, FF, and (surprisingly IE 6). However, it doesn’t work in IE 7/8. I’m trying to bind ‘click’ to a label. I’ve tried all of the following and nothing seems to work:
$('label').bind('click', function(){
alert('label clicked');
});
or
$('label').click(function(){
alert('label clicked');
);
or
// added a class to all labels
$('.label').bind('click', function(){
alert('label clicked');
});
or
// added a class to all labels
$('.label').click(function(){
alert('label clicked');
});
In all the browsers I listed, I’ll get a nice alert box, EXCEPT IE 7/8. Is this a jQuery issue, am I missing something, or what? I’m really confused because I’ve never had a problem like this before…
You should try using live() instead of bind(). Also, are you using the latest version of jquery?