jQuery radio button value validation

fsbholger

New Member
I'm using this in a form to check whether a radio button group has a certain value (Yes/No). The HTML for one of these is:\[code\]<form id="registerHere"><div class="control-group"><label class="radio"> <input type="radio" value="http://stackoverflow.com/questions/13774893/Yes" name="freemedia"> Yes </label> <label class="radio"> <input type="radio" value="http://stackoverflow.com/questions/13774893/No" name="freemedia" checked="checked"> No </label></div></form>\[/code\]And I'm using the following JS (jQuery.validate.js is included):\[code\]<script type="text/javascript"> $(document).ready(function(){});$("#registerHere").validate({ rules:{ freemedia:{ required:true, equalTo: "Yes" }, }, messages:{ freemedia:{ required:"Please select", equalTo:"Please apply to the 'freemedia' group first.</a>" }, }, }); }); </script>\[/code\]However, it is not checking the value correctly, as it always shows me the message, regardless of whether 'Yes' or 'No' is checked.Where am I going wrong?
 
Back
Top