• <i id='GCVV5'><tr id='GCVV5'><dt id='GCVV5'><q id='GCVV5'><span id='GCVV5'><b id='GCVV5'><form id='GCVV5'><ins id='GCVV5'></ins><ul id='GCVV5'></ul><sub id='GCVV5'></sub></form><legend id='GCVV5'></legend><bdo id='GCVV5'><pre id='GCVV5'><center id='GCVV5'></center></pre></bdo></b><th id='GCVV5'></th></span></q></dt></tr></i><div id='GCVV5'><tfoot id='GCVV5'></tfoot><dl id='GCVV5'><fieldset id='GCVV5'></fieldset></dl></div>
  • <small id='GCVV5'></small><noframes id='GCVV5'>

    1. <legend id='GCVV5'><style id='GCVV5'><dir id='GCVV5'><q id='GCVV5'></q></dir></style></legend>

          <bdo id='GCVV5'></bdo><ul id='GCVV5'></ul>
        <tfoot id='GCVV5'></tfoot>
      1. 使用 Jquery Mobile 选中和取消选中单选按钮

        时间:2023-10-20
          1. <legend id='ijarp'><style id='ijarp'><dir id='ijarp'><q id='ijarp'></q></dir></style></legend>
                <tbody id='ijarp'></tbody>

                <small id='ijarp'></small><noframes id='ijarp'>

                <i id='ijarp'><tr id='ijarp'><dt id='ijarp'><q id='ijarp'><span id='ijarp'><b id='ijarp'><form id='ijarp'><ins id='ijarp'></ins><ul id='ijarp'></ul><sub id='ijarp'></sub></form><legend id='ijarp'></legend><bdo id='ijarp'><pre id='ijarp'><center id='ijarp'></center></pre></bdo></b><th id='ijarp'></th></span></q></dt></tr></i><div id='ijarp'><tfoot id='ijarp'></tfoot><dl id='ijarp'><fieldset id='ijarp'></fieldset></dl></div>
                  <bdo id='ijarp'></bdo><ul id='ijarp'></ul>

                  <tfoot id='ijarp'></tfoot>
                  本文介绍了使用 Jquery Mobile 选中和取消选中单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我无法使用 jquery mobile 以编程方式检查一组复选框,我有以下代码:

                  I can't check a set of checkboxes programatically with jquery mobile, I have the following code:

                  <div data-role="fieldcontain"  id="div_radio" class="radiogroup">
                      <fieldset data-role="controlgroup">
                          <input type="radio" name="radio-pieces" id="radio-choice-1" value="3" checked="checked" />
                          <label for="radio-choice-1">1 to 3</label>
                  
                          <input type="radio" name="radio-pieces" id="radio-choice-2" value="5"  />
                          <label for="radio-choice-2">4 to 5</label>
                  
                          <input type="radio" name="radio-pieces" id="radio-choice-3" value="6"  />
                          <label for="radio-choice-3">over 5</label>
                      </fieldset>
                  </div>
                  

                  如果我这样做:$("input[type='radio']:last").attr("checked",true).checkboxradio("refresh"); 一切正常,但这些都不起作用:

                  If I do: $("input[type='radio']:last").attr("checked",true).checkboxradio("refresh"); everything works perfect, but none of this work at all:

                  $("input[type='radio']:first").attr("checked",true).checkboxradio("refresh");
                  $("input[type='radio']:eq(0)").attr("checked",true).checkboxradio("refresh");
                  $("input[type='radio']:eq(1)").attr("checked",true).checkboxradio("refresh");
                  $("input[type='radio']:eq(2)").attr("checked",true).checkboxradio("refresh");
                  

                  如何正确操作这些元素?取消选中所有复选框也可以正常工作:

                  How can I properly manipulate these elements? Unselecting all checkboxes also works fine:

                  $("input[type='radio']").attr("checked",false).checkboxradio("refresh");
                  

                  似乎唯一有效的复选框是最后一个.

                  It seems that the only checkbox working is the last one.

                  推荐答案

                  它们都工作得很好.您只需要在组中的所有 input radio 上触发 refresh.

                  They all work just fine. You just need to trigger refresh on all input radio in group.

                  $("input[type='radio']:first").attr("checked", "checked");
                  $("input[type='radio']").checkboxradio("refresh");
                  

                  jsFiddle 这里.

                  这篇关于使用 Jquery Mobile 选中和取消选中单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如果选中收音机,则需要输入字段 下一篇:标签下方的中心单选按钮

                  相关文章

                  <tfoot id='BMrPj'></tfoot>
                  <i id='BMrPj'><tr id='BMrPj'><dt id='BMrPj'><q id='BMrPj'><span id='BMrPj'><b id='BMrPj'><form id='BMrPj'><ins id='BMrPj'></ins><ul id='BMrPj'></ul><sub id='BMrPj'></sub></form><legend id='BMrPj'></legend><bdo id='BMrPj'><pre id='BMrPj'><center id='BMrPj'></center></pre></bdo></b><th id='BMrPj'></th></span></q></dt></tr></i><div id='BMrPj'><tfoot id='BMrPj'></tfoot><dl id='BMrPj'><fieldset id='BMrPj'></fieldset></dl></div>

                  <small id='BMrPj'></small><noframes id='BMrPj'>

                  • <bdo id='BMrPj'></bdo><ul id='BMrPj'></ul>

                      <legend id='BMrPj'><style id='BMrPj'><dir id='BMrPj'><q id='BMrPj'></q></dir></style></legend>