在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');

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2021-11-08
  • 2022-01-13
猜你喜欢
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2021-07-04
  • 2021-11-28
  • 2022-12-23
相关资源
相似解决方案