Dynamically checking two checkboxes to select one radio button using javascript -


i've been trying weekend solve problem may overcomplicating it. simplfied code i'm working below. appreciated - i'm racking brains long while now.

problem: upon checking of 2 checkboxes, respective radio button selected. selecting earth , wind checkboxes select 'earth , wind' radio button.

<input name="single" type="checkbox" id="earth"/>earth<br> <input name="single" type="checkbox" id="wind"/>wind<br> <input name="single" type="checkbox" id="emotion"/>emotion<br> <input name="single" type="checkbox" id="grass"/>grass<br> <input name="single" type="checkbox" id="good"/>good<br>  <hr>  <input name="pair" type="radio" class="earth wind"/>earth , wind<br> <input name="pair" type="radio" class="earth emotion"/>earth , emotion<br> <input name="pair" type="radio" class="earth grass"/>earth , grass<br> <input name="pair" type="radio" class="earth good"/>earth , good<br> <input name="pair" type="radio" class="wind emotion"/>wind , emotion<br> <input name="pair" type="radio" class="wind grass"/>wind , grass<br> <input name="pair" type="radio" class="wind good"/>wind , good<br> <input name="pair" type="radio" class="emotion grass"/>emotion , grass<br> <input name="pair" type="radio" class="emotion good"/>emotion , good<br> 

edit: evidence, efforts: http://jsfiddle.net/rsf6w/: i've disabled checkboxes after 2 checked.

you going want attach event handlers onclick events. inside these functions grab of box's states. in event 2 states checked check appropriate radio button. problem solve. complete code soil learning experience.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -