Issue with obtaining the value of the checked radio button in a group?
Issue with obtaining the value of the checked radio button in a group?
by Thulasi Ram.S
HTML
<ul id="ImageSelection">
<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>
<li>
<div class="xmasImage rounded" rel="http://www.completeinsight.co/resources/xmasHR/56270.jpg">
<img class="rounded" src="http://www.completeinsight.co/resources/xmasLR/56270_p.jpg"
width="65" height="65" border="0" alt="56270" />
<div class="imageSelect">
<input type="radio" name="selectedImage" value="56270">
<label for="selectedImage">56270</label>
</div>
</div>
</li>
</ul>
JavaScript
$(document).ready(function () {
var currentImageFile = '';
$('#ImageSelection').find('input:radio[name=selectedImage]').click(function () {
currentImageFile = $(this).val();
alert($(this).val());
});
});