Problem with jQuery
Can anyone help me out with this???
Member • Apr 3, 2011
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="https://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#submit').click(function() { $(".error").hide(); var hasError = false; var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var emailaddressVal = $("#uname").val(); if(emailaddressVal == '') { $("#uname").after('<span class="error">Please enter user name.</span>'); hasError = true; } else if(!emailReg.test(emailaddressVal)) { $("#uname").after('<span class="error">Please, Enter a valid username(email).</span>'); hasError = true; } if(hasError == true) { return false; } else { window.location="welcome.php"; } }); }); </script> </head> <body> <form method="post" name="form1" action=""> <fieldset> Username:<input type="text" id="uname" /> <br /> Password:<input type="password" id="pwd" /> <br /> <input type="submit" value="Submit" id="submit" /> </fieldset> </form> </body> </html>
Member • Apr 3, 2011
Member • Apr 3, 2011
Member • Apr 5, 2011
Member • Apr 5, 2011
brother it worked for me when I change it and then checked out.nicepeeyushNo answers...😔. Anyways i figured it out. If i give the name of php file itself in the form, the code is working fine.