I got stuck at a particular situation
I have 2 radio buttons
<input type="radio" value="YES" id="sub" name="sub">Yes
<input type="radio" value="NO" id="sub" name="sub">No
When, Yes is selected, I need to validated 1 text-field
<input type="text" id="price" name="price" />
I am using jQuery validation plug-in
Please help me with this, Thanks.
You can set up dependency validation as seen here http://docs.jquery.com/Plugins/Validation/Methods/required#dependency-expression
$('#myForm').validate(rules: {
price: {
required: '#sub[value="YES"]:checked'
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With