$(document).ready(function() {
$(".selector input.testcheck").click(function () {
var test = $(this).val();
if ($(this).attr("checked")) {
$(".selector input.testcheck[value!=" + test + "]").attr('checked', false);
$(".selector input.testcheck[value=" + test + "]").attr('checked', true);
}
else {
$(this).removeAttr("checked")
}
});
});
----------------------------------
<div class="selector">
<input type="checkbox" name="cbxtest" value="1" class="testcheck"/>YES
<input type="checkbox" name="cbxtest" value="2" class="testcheck"/>NO
</div>
$(".selector input.testcheck").click(function () {
var test = $(this).val();
if ($(this).attr("checked")) {
$(".selector input.testcheck[value!=" + test + "]").attr('checked', false);
$(".selector input.testcheck[value=" + test + "]").attr('checked', true);
}
else {
$(this).removeAttr("checked")
}
});
});
----------------------------------
<div class="selector">
<input type="checkbox" name="cbxtest" value="1" class="testcheck"/>YES
<input type="checkbox" name="cbxtest" value="2" class="testcheck"/>NO
</div>
No comments:
Post a Comment