Why can't I trigger the submit button's closest form in this example below?
html,
<form name="input" action="html_form_action.asp" method="get">
Username: <input type="text" name="user">
<input type="submit" value="Submit">
</form>
jquery,
$('input[type=submit]').click(function(){
$(this).closest('form').unbind('submit').submit(function(){
alert("hello world");
return false;
});
return false;
});
I should get the alert message, but I can't. What have I done wrong?
the jsfiddle