JSFiddle - React, Tailwind, and code Playground

by ChrisStanyon

HTML

<input value="number1" />
<label>
<img src="" style="width:150px; height:50px" alt="click me" />
</label>

<input value="number2" />
<label>
<img src="" style="width:150px; height:50px" alt="click me" />
</label>

<input value="number 3" />
<label>
<img src="" style="width:150px; height:50px" alt="click me" />
</label>

CSS

input, img { display:block; }

JavaScript

$('img').click(function(){
    alert( $(this).parent('label').prev('input').val() );
})