Check only one
Radio from check
by mahish
HTML
<input type="checkbox" name="foo" value="bar" class="checkIt" />Name
<br/>
<input type="checkbox" name="class" value="bar" class="checkIt" />class
<br/>
<input type="checkbox" name="age" value="bar" class="checkIt" />Age
<br/>
<input type="checkbox" name="gender" value="bar" class="checkIt" />Gender
<br/>
<span id='imgloc' style='display:none;'><img src="http://farm4.static.flickr.com/3221/2658147888_826edc8465.jpg" height="350px" ></span>
JavaScript
jQuery(document).ready(function ($) {
$(".checkIt").change(function (e) {
if ($("input:checkbox:checked").length > 1) {
alert("Only one attribute is allowed.");
$(e.target).prop('checked', false);
}
});
});