Jump to content
ganesh12

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

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>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...