简体   繁体   中英

Several radio buttons selected at same time

I have several dynamically created rows that have radio buttons in them. Every time I click on one radio button it sets all the other radio buttons to false. Is there a way so only one radio button becomes false and not the rest of the radio buttons?

Do you own the code generating the dynamically created rows? The functionality you're aiming for is indicative of check boxes rather than radio buttons.

You probably need to group your radio buttons by name

Example:

<input type='radio' name="group1" /> 
<input type='radio' name="group1" /> 
<input type='radio' name="group1" />

<input type='radio' name="group2" /> 
<input type='radio' name="group2" /> 
<input type='radio' name="group2" />  

If you click a radio button in group2 it shouldn't affect group1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM