I have a couple of functions bound to the click event for a link.
//submit forms when links are clicked
$("a.submit").click(function(e){
e.preventDefault();
$("form").submit();
});
and:
//turn this off in webkit for now
//if (!$.browser.webkit){
$("a.btn").click(function(e){
//if this is a submit or a save button
if ($(this).hasClass('submit') || $(this).hasClass('save')){
//check if there were validation errors
if(validator.numberOfInvalids()===0){
//only switch out the link if there weren't any
btn_ajaxload($(this));
}
}else{
btn_ajaxload($(this));
}
});
//}
btn_ajaxload()
replaces the entire <a>
element with an ajaxload image. It works as expected in Firefox, IE6, IE7 and IE8 but I cannot get it to work in Chrome or Safari. If I comment out the first function's $("form").submit()
line then the 2nd function works, but I can't get them both to work together.
The solution I'm leaning towards is to merge the two functions together but I'm wondering if there's a reason why it doesn't work in WebKit browsers?