<form:radiobuttons path="isInsuredCasualty" class="input-xxlarge" items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
//獲取input的disable屬性 true false
$("input[name='isInsuredCasualty']").is(":disabled")
//判斷input是否選中
$("input[name='isInsuredCasualty']").is(":checked")
//設置input的disable為true 不能選
$('input:radio[name="isInsuredCasualty"]').prop("disabled",true);
//移除input的選中狀態
$('input:radio[name="isInsuredCasualty"]:checked').removeAttr("checked");
prop與attr
prop()是 jQuery 1.6 開始新增了一個方法,官方建議具有 true 和 false 兩個屬性的屬性,如 checked, selected 或者 disabled 使用prop(),其他的使用 attr()。 可以將attribute理解為“特性”,property理解為為“屬性”從而來區分倆者的差異。 例如設置元素的disabled屬性: $('input:radio[name="isInsuredCasualty"]').prop("disabled",true); 設置元素的點擊事件 用attr $('#buttionId').attr("onclick","");
