Submitting with document.forms['...'] and jq submit handler
I really need to get the submit handler in jquery working with legacy javascript. Here is some example code:
-
<form name="aform" id="aform">
<input type="submit" /><br/>
<a href="#" onclick="$('#aform').submit();">submit with jquery</a><br/>
<a href="#" onclick="document.forms['aform'].submit();">submit with old js</a>
</form>
<script type="text/javascript">
$(document).ready(function(){
$("#aform").submit(
function(){ alert("Submitted"); });
});
</script>
Basically I have some jsf controls that use javascript to submit a form using non-query syntax. When it is submitted, I need to do stuff but can't seem to catch the submit event. Using a submit button works. Using jquery to submit a form works, using legacy javascript document.forms... doesnt work. I've been stuck here all day
.. please help.
Thanks folks,
C