I have this jquery
$('input#application_submit.bigbutton[value=Agree]').click(function(e){
e.preventDefault();
var reason = $('.agree_reason:visible');
var reason_text = $('.agree_reason:visible textarea');
if(reason.length == 0){
$('.agree').show();
}else{
if(reason_text.val() == ''){
$('.agree').show();
$('#application_agree').css('border', '1px solid #CC0000');
$('.agree_validation_message').show();
}else{
$('input#application_submit.bigbutton[value=Agree]').unbind();
$('input#application_submit.bigbutton[value=Agree]').click();
}
}
});
and all is great up until the unbind….what i need it to do is remove this handler and do the normal click event but its freezing up my browser because its in a infinite loop i guess….i ever tried the jQuery die fundtion and also no luck…any ideas
You have to pass the event type to
unbindAlso, based on PeeHaa’s comment,
application_submitis the element id, and since elements in the dom are unique (or at least better be), you can simplify this toYou’re almost always better off selecting by a simple id like this, since jQuery can defer to the native
document.getElementByIdunder the covers.Another improvement would be: