<legend id='klGga'><style id='klGga'><dir id='klGga'><q id='klGga'></q></dir></style></legend>
      <bdo id='klGga'></bdo><ul id='klGga'></ul>
  1. <tfoot id='klGga'></tfoot>

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

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

      使用 Twitter Bootstrap 切换单选按钮,获取表单输入的简洁方式是什么?

      With Twitter Bootstrap toggle radio buttons, what#39;s the clean way to get form input?(使用 Twitter Bootstrap 切换单选按钮,获取表单输入的简洁方式是什么?)

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

            • <small id='CwfIY'></small><noframes id='CwfIY'>

                <tfoot id='CwfIY'></tfoot>

                本文介绍了使用 Twitter Bootstrap 切换单选按钮,获取表单输入的简洁方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 Twitter Bootstrap 的 Javascript 单选切换按钮,并且想要获取表单基于切换状态的输入.

                I am using Twitter Bootstrap's Javascript radio toggle buttons and want to get form input based on the state of the toggle.

                我能找到的最简单的方法是在按钮中添加一个不可见的标签 -- 这里是有用的 jsFiddle 某人吐出的例子.

                The simplest approach I could find is to add an invisible tag within the buttons -- here's the helpful jsFiddle example that someone threw up.

                它工作得很好,但它仍然有点杂乱无章.我的问题是:从这些按钮获取表单输入的干净方式是什么,即没有额外的隐藏单选输入?

                It works nicely, but it's still sort of a kludge. My question is: what's the clean way to get form input from these buttons, i.e. without the extra hidden radio inputs?

                推荐答案

                怎么样

                $(this).children('input[name="is_private"]').val()
                

                演示

                我想我第一次看错了你的问题......你可以创建一个隐藏的表单元素(你需要它在提交表单时访问值,除非你做 AJAX)并使用 JS 来设置它的值.

                I think I misread your question the first time... You can create a hidden form element (you need it to access the value when you submit the form unless you do AJAX) and use JS to set its value.

                HTML

                <input type="hidden" name="status" id="status" value="" />
                

                JS

                $('div.btn-group button').click(function(){
                
                    $("#status").attr('value', $(this).attr('id'));
                
                })
                

                演示

                这篇关于使用 Twitter Bootstrap 切换单选按钮,获取表单输入的简洁方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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 自动选择特定的单选按钮?)
                  <bdo id='VxJgN'></bdo><ul id='VxJgN'></ul>

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

                        2. <small id='VxJgN'></small><noframes id='VxJgN'>

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