Jump to content

Always getting first radio button value?how do get desired radio button value?


ganesh12
 Share

Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="js/jquery-1.9.0.min.js"></script>
<script src="js/jquery.validate.min.js"></script>
</head>
<body>
<form id="loginForm" method="post">
Enter Name<input type="text" name="txtname"><br />
Enter Email<input type="text" name="txtemail"><br />
Enter ######:<input type="radio" name="gender" value="male">male
<input type="radio" name="gender" value="female">female<br>
<input type="submit" value="Login" />
</form>
<script>
$(document).ready(function(){
$('#loginForm').validate({
rules:{
txtname:{
required:true,
minlength:1,
maxlength:40
},
txtemail:{
required:true,
email:true
},
gender:{
required:true,
},
},
messages:{
txtname:{
required:"Name required",
minlength:"Name at least 1 char long",
maxlength:"Name max 40 char long"
},
txtemail:{
required:"Email Required",
email:"Invalid Emal"
},
gender:{
required:"gender is required",
}
}
});
});
</script>
</body>
</head>
</html>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...