标签:alert code dom line 按钮 单选按钮 rop str check
<input type="radio" name="xxx">
$(function() {
$(‘input:radio’).click(function () {
//alert(this.checked);
var domName = $(this).attr(‘name‘);
var $radio = $(this);
// if this was previously checked
if ($radio.data(‘waschecked‘) == true) {
console.log($radio.data(‘waschecked‘) == true);
$radio.prop(‘checked‘, false);
//$("input:radio[name=‘radio" + domName + "‘]").data(‘waschecked‘,false);
$radio.data(‘waschecked‘, false);
} else {
console.log($radio.data(‘waschecked‘) == true);
$radio.prop(‘checked‘, true);
//$("input:radio[name=‘radio" + domName + "‘]").data(‘waschecked‘,true);
$radio.data(‘waschecked‘, true);
}
});
});
标签:alert code dom line 按钮 单选按钮 rop str check
原文地址:https://www.cnblogs.com/ming-blogs/p/10289036.html