Submit button and function coding
I am new to Javascript and jQuery. I have a form with a multiple submit buttons, each with an id. In the example below, the id="modify". What I want to do, is create a click event (or submit event) that will execute the code within the called function 'modify''.
I have the function code in the head section and the form's submit button in the body. Here is the code I have been trying to get to work:
<script type="text/javascript" src="../schedule/js/jquery-1.7.1.min.js"></script>
<script>
document.onload initAll():
function initAll(){
document.mainContainer.getElementById("modify").submit = showResults;
}
function showResults(){
alert("It worked!");
}
</script>
<body>
<fieldset form id="maintContainer" style="border:none; display:none;">
<form name="modifyJob" id="modifyJob" action="modify" >
<fieldset>
<legend><strong> MODIFYNAMD </strong></legend>
Job ID#: <select name="IdNum" style="margin-left: 15px;">
<option value="#">Choose....</option>
</select><br>
<input type="submit" value="Do It!" onclick=initAll()>
</fieldset>
</form>
</body>