Jquery代码如下:
-
$("#add_form .radio input").bind("click",function(){
-
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);
-
}
-
// remove was checked from other radios
-
$radio.siblings('input[type="radio"]').data('waschecked', false);
-
});