I have a several images like this:
<div class="attribImg"><img data-id="9" src="images/attributes/black.jpg" alt="Black"></div>
<div class="attribImg"><img data-id="3" src="images/attributes/red.jpg" alt="Black"></div>
<div class="attribImg"><img data-id="7" src="images/attributes/green.jpg" alt="Black"></div>
<div class="attribImg"><img data-id="8" src="images/attributes/blue.jpg" alt="Black"></div>
... and a hidden data field like this:
<input type="hidden" id="id[1]" name="id[1]" value="1">
I am looking for the correct way to change the value of the hidden input on click of the images based on what is set with data-id
in the images.