Please take a look at my test page, my issue is to do with finding the value of the selected radio button in the “Select picture” group.
On loading I have used the following code:
var currentImageFile = $("input:radio[name=selectedImage]:checked").val();
which picks up the default image for the “Selected picture” div on the left. So far so good.
Now the problem is when a “Select picture” radio button is subsequently clicked my event code:
$("input:radio[name=selectedImage]").click(function() {
currentImageFile = $(this).val();
alert($(this).val());
});
(the alert is for testing only) returns no value at all!
The HTML is pretty straight forward:
<li><div class="xmasImage rounded" rel="http://www.completeinsight.co/resources/xmasHR/56269.jpg">
<img class="rounded" src="http://www.completeinsight.co/resources/xmasLR/56269_p.jpg" width="65" height="65" border="0" alt="56269" />
<div class="imageSelect"><input type="radio" name="selectedImage" value="56269">
<label for="selectedImage">56269</label>
</div>
</div></li>
I am missing the obvious??
1 Answer