Should submit event be fired?
This is the html file. When 'Submit 1' is clicked submit event is fired. But, when 'Submit 2' is clicked the event is not fired.
- <html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script>
<script type="text/javascript">
jQuery(function() {
jQuery("form").submit(function() {
alert('submit');
});
});
</script>
</head>
<body>
<a href="#" onclick="jQuery('#homeButton').get(0).click();">Submit 1</a>
<a href="#" onclick="jQuery('#homeButton').click();">Submit 2</a>
<form>
<button id="homeButton" type="submit">Submit</button>
</form>
</body>
</html>