My form has validation using Parsley. The submit button uses JavaScript code to animate via CSS. This works well in Firefox and Chrome, but not in Safari (both desktop and iOS). Validation is successful, but the animation doesn't play.
After some investigation, I found that the issue lies with the return true; statement. When set to return false;, Safari works correctly, but the form doesn't submit. Setting it to return true; makes it work everywhere except Safari.
I've come across information suggesting that Safari behaves differently with jQuery, requiring modifications to ensure cross-browser compatibility. How can I adjust this code to work universally?
<script type="text/javascript>
$(function() {
$('#login-form').parsley().on('form:submit', function() {
$(".loginbutton").addClass("loginactive");
$(".loginbutton").css("background", "transparent");
setTimeout(function() {
$(".loginbutton").addClass("loginsuccess");
$(".loginbutton").css("background", "none repeat scroll 0 0 #ffffff");
}, 3700);
return true;
});
});
</script>