user3835327
user3835327

Reputation: 1204

validate radio button not working jquery

How to perform validation radiobutton. failed to perform the radio button validation when use button type button instead input type submit.

Demo : http://jsfiddle.net/05qm3r4m/63/

Upvotes: 0

Views: 1299

Answers (1)

Mayank Pandeyz
Mayank Pandeyz

Reputation: 26288

Try this:

$(document).ready(function() {
    $('#myform').validate({
    rules:{
        foobar : 
      {
        required: true
      }
    }
  });
});

Updated Fiddle

There are so many issue with your code.

  • You have to give similar name for all the radio resides in one group, otherwise they work like checkbox.
  • Jquery validation works on name for the specific element. So name is mandatory.

Updated Fiddle with custom message

Upvotes: 2

Related Questions