Jump to content
Stef's Coding Community

javanut

New Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About javanut

  • Rank
    New member
  1. I was able to get this script working, but now when form submit button is clicked the warning box appears. I only want the warning box if visitor trys to leave, etc. And I don't want the warning box when they click on submit. Anyone know how to make this so? var submitted = false; window.onbeforeunload = function() { window.onbeforeunload = null; location.assign('http://site.com); return "Stay here bla bla"; }; $("#formID").submit(function () { submitted = true; }); <form id="formID" method="post" action="http://site.com"> <input type="hidden" name="first_name" value="" /> <input type="hidden" name="last_name" value="" /> <input type="hidden" name="phone" value="" /> <input class="input_txt" type="text" id="email" name="email" value="Enter your best email..." onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" /> <input type="submit" class="btn_get_access" value="Get Instant Access »"> </form> ***Apparently, the following code is not working. For one thing I get $ is undefined. Any help would be great. $("#formID").submit(function () { submitted = true; });
×
×
  • Create New...