views:

29

answers:

0

A form with a single textfield is given. A submit handler is bound on the form and a change/focus/blur handler bound on the textfield.

When something is entered into the textfield and the submit button is then clicked, only the change/focus/blur event is registered in Firefox, while in Safari, both are registered.

The form:

<form id="form1" action="" method="get">
<input id="text1" name="text1" type="text" />
<input id="submit1" name="submit1" type="submit" />
</form>

The Jquery code:

$(document).ready(function(){
 $('#text1').change(function(){ alert("1"); });
 $('#form1').submit(function(){ alert("2"); });
});

In Firefox: "1" is alerted. In Safari, "1" is alerted, then "2" is alerted.

How can I get the behaviour in Safari to work in Firefox?