Example from documentation $("form").submit(function() { if ($("input:first").val() == "correct") { $("span").text("Validated...").show(); return true; } $("span").text("Not valid!").show().fadeOut(1000); return false; });
html: <p>Type 'correct' to validate.</p> <form action="javascript:alert('success!');" id="smth_id"> <div> <input type="text" /> <input type="submit" /> </div> </form> <span></span> BUT! When you get form throw document.getElementById and submit it by javascript: var form = document.getElementById('smth_id'); form.submit(); jquery event handler doesn't work How to attach event to form by jquery correctly? I need it for tinyMCE integration, I think it will be usefull for 3d party libs integration anyway