【问题标题】:Cannot change selection of jquery mobile radio button无法更改 jquery mobile 单选按钮的选择
【发布时间】:2015-01-04 02:24:51
【问题描述】:

我不断收到错误消息“对象不支持属性或方法'checkboxradio'”。我正在使用最新的 jquery mobile 1.4.3、Visual Studio 2013 和 Internet Explorer 11。我的主要目标是将其放入后面的 c# 代码中,以根据从数据库中检索到的信息更改单选按钮的选择。

我也尝试了以下
$('input[id*=radio-choice-h-Corporate').attr('checked',true).checkboxradio('refresh');
$('#radio-choice-h-Corporate').prop('checked',false).checkboxradio('refresh');

这些都不行

<div data-role="fieldcontain">
  <fieldset data-role="controlgroup" data-type="horizontal">
    <legend>Customer Type:</legend>
    <input name="radioCustomerType" id="radio-choice-h-Personal" value="1"  type="radio">
    <label for="radio-choice-h-Personal">Personal</label>
    <input name="radioCustomerType" id="radio-choice-h-Corporate" value="2" type="radio">
    <label for="radio-choice-h-Corporate">Corporate</label>
  </fieldset>
</div>
  
<script type="text/javascript">
  $('#radio-choice-h-Corporate').attr("checked", false).checkboxradio("refresh");
</script>

【问题讨论】:

    标签: jquery mobile radio-button


    【解决方案1】:

    您只需要在所有输入单选元素上触发刷新:

    $('#radio-choice-h-Corporate').attr("checked", false);
    $("input[type='radio']").checkboxradio("refresh");
    

    【讨论】:

      猜你喜欢
      • 2016-07-02
      • 1970-01-01
      • 2013-03-11
      • 2020-04-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-09
      • 2018-09-17
      相关资源
      最近更新 更多