Board index   FAQ   Search  
Register  Login
Board index PHP Your Scripts

form validation (client side) using jquery

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

form validation (client side) using jquery

Postby phpkiller » Mon May 19, 2014 11:48 pm

Here is the code:

<html>
<head>
<title>login page validation using jQuery</title>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
<!-- This is suggested that you must use the latest jQuery code here -->
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#submit').click(function(){
var username=$('#email').val();
var password=$('#password').val();

if(username=="")
{
$('#msg').slideDown().html("<span>Please type Username</span>");
return false;
}
if(password=="")
{
$('#msg').slideDown().html('<span id="error">Please type Password</span>');
return false;
}
});
});
</script>
</head>
<body>

<fieldset style="width:250px;">
<form method="post" action="index.php">
Log-in page validation (client side) using jQuery

<div id="dis"></div><br>
Username: <input type="text" name="email" id="email" /><br />
Password: <input type="password" name="password" id="password" /><br /><br />
<center><input type="submit" name="submit" id="submit" /></center>
</form>

</fieldset>
</body>
</html>
phpkiller
New php-forum User
New php-forum User
 
Posts: 31
Joined: Thu Jun 28, 2012 2:11 pm

Return to Your Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.