I have created a simple login form and am working on validation. Currently, I just check to make sure there is actually something filled out in the name field and, if not, when the user clicks the "submit" button, a div appears underneath the input indicating that the user needs to fill out their name.when I submit the form, this works fine, but then the page quickly refreshes and it goes away. Does anyone know what's going on?Code:$('form').submit(function(){ if ( $('#userName').val() == '') { $("<div class='error'>please provide your user name to continue</div>").insertAfter('#userName');} });
You can see a sample at http://peter.byuipt.net/sites/rewardSystem/



Reply With Quote
Bookmarks