I'd like to add the index of a given radio button to a URL string, but in the middle and have that passed to the value of a hidden input in a form.
here is the code so far:
jQuery
<script type='text/javascript'>//<![CDATA[
$(function(){
$('input[name="Names"]').click(function () {
var idx = $(this).index(':radio')
$('.submission input[name="image"]').val("http://URL/images/0 + (idx + 1) + .jpg");
})
});//]]>
</script>
HTML
<div class="submission">
<input type="hidden" name="name" value="I'm Here Notification Sign" />
<input type="hidden" name="price" value="10" />
<input type="hidden" name="image" value="http://URL/images/01.jpg"/>
</div>
This obviously doesn't work, but for output i'd like to see http://URL/images/02.jpg
when clicking on radio button 2 etc.
Thanks!