• <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 选中和取消选中单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  <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>