Jquery mobile中的 checkbox和radio的設置問題
阿新 • • 發佈:2017-06-20
prop 不顯示 jquery 讀取 兩個 mob att attr 設置
在Jquery Mobile網頁中用JS控制Radio的狀態一直達不到目的。
用$("input[name=‘radio‘]:first").prop("checked",true)設置checked的時候,用.attr("checked")讀取不到值。
用$("input[name=‘radio‘]:first").attr("checked",true)設置checked的時候,頁面顯示狀態變為兩個都不顯示。
最後只能把prop和attr都寫在裏面,才算解決了問題。
當然最後的refresh也是必須的,否則也不更新狀態。
$("input[name=‘radio‘]:first").prop("checked",true).checkboxradio(‘refresh‘);
$("input[name=‘radio‘]:first").attr("checked",true).checkboxradio(‘refresh‘);
$("input[name=‘radio‘]:last").attr("checked",false).checkboxradio(‘refresh‘);
$("input[name=‘radio‘]:last").prop("checked",false).checkboxradio(‘refresh‘);
Jquery mobile中的 checkbox和radio的設置問題