• <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 选中和取消选中单选按钮

        Checking and unchecking radio buttons with Jquery Mobile(使用 Jquery Mobile 选中和取消选中单选按钮)
          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 选中和取消选中单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  keeping radio buttons checked after form submit(表单提交后保持选中单选按钮)
                  Bootstrap radio button quot;checkedquot; flag(Bootstrap 单选按钮“已选中旗帜)
                  Toggle HTML radio button by clicking its label(通过单击标签来切换 HTML 单选按钮)
                  Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)
                  JavaScript radio button confirmation(JavaScript 单选按钮确认)
                  How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)
                  <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>

                            <tbody id='BMrPj'></tbody>

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