开发者

Limiting number of checkable radios in a page

开发者 https://www.devze.com 2023-02-06 18:51 出处:网络
Evening all, Been trying to do this for a day now but can\'t figure it out. I\'ve got a page filled with 5 groups of radio selects, with 3 selects in each group.

Evening all,

Been trying to do this for a day now but can't figure it out.

I've got a page filled with 5 groups of radio selects, with 3 selects in each group.

GROUP 1   | GROUP 2   | GROUP 3  开发者_StackOverflow中文版 | GROUP 4   | GROUP 5
radio 1-1 | radio 1-1 | radio 3-1 | radio 4-1 | radio 5-1
radio 1-2 | radio 2-2 | radio 3-2 | radio 4-2 | radio 5-2
radio 1-3 | radio 2-3 | radio 3-3 | radio 4-3 | radio 5-3

Of course, user is limited to selecting only one radio within each group, but I want to be able to limit the total number of radios on the whole page a user can select ... to, say, 3 ... then all the other radios would be deselected.

Would also like to display what radios are currently selected in a separate area ... but I can't figure out how to make jquery work with multiple radio groups! With checkboxes it's simply :checked ... but since checking a radio deselects other radio in same group, don't know how to emulate that.

Any help is much appreciated.


I have implemented this in 30 mins, I know it can be done much better. Probably you will get idea how to go about it.

Its too late for me now. May be tomorrow i might make it a better version of it.

http://jsfiddle.net/eGZQV/

0

精彩评论

暂无评论...
验证码 换一张
取 消