项目开发需要,直接贴代码在JavaScript中,即可实现对于页面所有的radio实现:
// jquery
$('input:radio').click(function(){
//alert(this.checked);
//
var $radio = $(this);
// if this was previously checked
if ($radio.data('waschecked') == true){
$radio.prop('checked', false);
$radio.data('waschecked', false);
} else {
$radio.prop('checked', true);
$radio.data('waschecked', true);
}
});