why if I put some code with “if” inside a submit function the method (apparently) always returns a true and submits the form?
example
var test = "test";
$("#contact_form").submit(function(){
if (test == "random"){
}
return false;
});
whenever I put an if like this with or without any code it always submits.
Stop the default action before you run any code. And, add
===. It checks against type as well.