以下两种方法等价:
<input id="test-radio" type="radio" name="test" checked value="1">
<input id="test-radio" type="radio" name="test" checked="checked" value="1">
attr()和prop()对于属性checked处理有所不同:
var radio = $('#test-radio');
radio.attr('checked'); // 'checked'
radio.prop('checked'); // true
prop()返回值更合理一些,不过用is()方法判断更好
var radio = $('#test-radio');
radio.is(':checked'); // true
类似的还有 is(":selected")