Im new to the jquery validate() plugin and I'm kind of lost here. So, what I want to do is to check if the selected radio button is equal to a variable:
So, lets say I have this in the form:
<input name = "radio_btns" value = "five" type = "radio">5
<input name = "radio_btns" value = "eight" type = "radio">8
I want to validate it to make sure the "five" option is selected, and I want to use a Javascript variable. I tried this, it is kind of obvious it won't work, anyway:
<script>
var required_answer = "five";
$(document).ready(function(){
$('#theform').validate({
rules: {
radio_btns: {
required: true,
equalTo: required_answer <--- problem here ¬.¬
}
...
</script>
Thanks in advance for your help.