I built a rather complex form that includes a hidden section, which the user can switch to enter additional information if necessary. However, when you click on the toggle button indicated by I have more Nativities , it launches the submit button and submits the form prematurely.
The form is in dev right now, but it can be found here .
The code I use for the toggle button is:
<script type="text/javascript"> $(function() { $("#schedule").accordion({ header: "h5", collapsible: true }); $("#more-nativities").hide(); $("#toggle").click(function() { $("#more-nativities").slideToggle("slow"); }); }); </script>
The submit button code is pretty simple:
<input id="submit2" type="image" src="_images/btn_register.jpg" name="submit" alt="" onmouseover="javascript:this.src='_images/btn_register2.jpg'" onmouseout="javascript:this.src='_images/btn_register.jpg'"/>
Code for the toggle button:
<button id="toggle">I have more nativities</button>
Any ideas as to why the toggle button triggers the send? And more importantly, how to solve the problem?
Thanks!
javascript jquery
fmz
source share