mercredi 27 juillet 2016

jQuery: IF conditions for multiple radio button fields?

http://ift.tt/2awOTx5

  <form action="">
<input type="radio" name="colour" value="black"> black
<br>
<input type="radio" name="colour" value="white"> white
<br>

<br>

<input type="radio" name="form" value="round"> round
<br>
<input type="radio" name="form" value="triangle"> triangle
<br>

There are two form-fields "colour" and "forms" with radio buttons that decide which image to show. Choosing the colour works as seen in the fiddle.

If the user now checks triangle in the second field (name="forms") I want a white triangle to show. If he checks black in "colour" and "round" in forms it should change the img src to black_round.jpg and so on.

This is a simplified version. I will have many fields and many more options in the end.

Thanks for your help!

Aucun commentaire:

Enregistrer un commentaire