I have a form and an internal division:
<form action="#" name="form" id="identification_form" class="classification_form">
<div name="division" id="identification_division" class="classification_division">
</div>
</form>
JavaScript manipulating with events:
document.getElementById('identification_division').onClick = function(event){
document.getElementById('identification_form').submit(); //does NOT trigger element.onsubmit event
}
document.getElementById('identification_form').onSubmit = function(event){
alert("submitted!")
}
The form successfully submits but does not call the event
The element.onsubmit event only works when using a submit button inside the form and manually clicking the button (or pressing enter while in focus of another input element)
How can i make element.onClick call the the onSubmit function?
when using element.onSubmit i get an undefined error in the browser console.
My current solution:
function submition(event){
alert("submitted");
}
document.getElementById('identification_division').onClick = function(event){
submition(event || null);
document.getElementById('identification_form').submit();
}
document.getElementById('identification_form').onSubmit = function(event){
submition(event || null);
}
Note my current solution can cause a memory leak in early versions of Opera & Internet Explorer.
JQUERY is not an option