Mark Locklear
Mark Locklear

Reputation: 5325

jQuery and radio button validation of groups

I'm hoping someone can help out with this. I modified code from jQuery and radio button groups but cannot get it to work. Here is my HTML:

https://gist.github.com/1319498

Here is the jquery:

https://gist.github.com/1319503

I fail the if statement in !!$(":radio[name="+group+"]:checked").length) and never set valid to true whether I chose a radio button or not.

Upvotes: 2

Views: 621

Answers (1)

Blazemonger
Blazemonger

Reputation: 92893

You need to surround the selector modifier with single-quotes:

!!$(":radio[name='"+group+"']:checked").length) 

Upvotes: 2

Related Questions