Help with hiding the submit button
I have a script that hides the 'submit to cart' button until all the required fields have been filled out.
Does anyone have any idea why it won't work in IE7/IE8 but it does work in Firefox?
The script:
- <script type="text/javascript" language="javascript">
- function checkform(){
- var f = document.forms["myform"].elements;
- var cansubmit=true;
- for (var i = 0; i < f.length; i++) {
- if (f[i].value.length==0) cansubmit=false;}
- if (cansubmit){document.getElementById('submitbutton').disabled=false;
- }}
- </script>
The form:
- <form id="myform" method="post" action"">
- <input class="txt_input input" name="First-Name" onkeyup="checkform()" type="text">
- <input class="txt_input input" name="Last-Name" onkeyup="checkform()" type="text">
- <input id="submitbutton" type="submit" disabled="disabled" name="submit" value="Add to Cart" class="foxycart foxbutton" />
- </form>
Any help would be greatly appriciated!