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

<tfoot id='bx4Gu'></tfoot>
<legend id='bx4Gu'><style id='bx4Gu'><dir id='bx4Gu'><q id='bx4Gu'></q></dir></style></legend>

        <bdo id='bx4Gu'></bdo><ul id='bx4Gu'></ul>

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

      1. 为什么单选按钮不能“只读"?

        Why can#39;t radio buttons be quot;readonlyquot;?(为什么单选按钮不能“只读?)
          <tbody id='PzmDC'></tbody>
        <tfoot id='PzmDC'></tfoot>
        <i id='PzmDC'><tr id='PzmDC'><dt id='PzmDC'><q id='PzmDC'><span id='PzmDC'><b id='PzmDC'><form id='PzmDC'><ins id='PzmDC'></ins><ul id='PzmDC'></ul><sub id='PzmDC'></sub></form><legend id='PzmDC'></legend><bdo id='PzmDC'><pre id='PzmDC'><center id='PzmDC'></center></pre></bdo></b><th id='PzmDC'></th></span></q></dt></tr></i><div id='PzmDC'><tfoot id='PzmDC'></tfoot><dl id='PzmDC'><fieldset id='PzmDC'></fieldset></dl></div>
            • <bdo id='PzmDC'></bdo><ul id='PzmDC'></ul>

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

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

                • 本文介绍了为什么单选按钮不能“只读"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想显示一个单选按钮,提交它的值,但根据具体情况,它是否不可编辑.Disabled 不起作用,因为它不提交值(或者提交了?),并且它使单选按钮变灰.只读是我真正想要的,但由于某种神秘的原因它不起作用.

                  I would like to show a radio button, have its value submitted, but depending on the circumstances, have it not editable. Disabled doesn't work, because it doesn't submit the value (or does it?), and it grays out the radio button. Read-only is really what I'm looking for, but for some mysterious reason it doesn't work.

                  我是否需要使用一些奇怪的技巧才能使只读模式按预期工作?我应该只用 JavaScript 来做吗?

                  Is there some weird trick I need to pull to get read-only to work as expected? Should I just do it in JavaScript instead?

                  顺便说一句,有谁知道为什么只读在单选按钮中不起作用,而在其他输入标签中起作用?这是 HTML 规范中那些难以理解的遗漏之一吗?

                  Incidentally, does anyone know why read-only doesn't work in radio buttons, while it does work in other input tags? Is this one of those incomprehensible omissions in the HTML specs?

                  推荐答案

                  我通过仅禁用未选中的单选按钮在单选按钮上伪造了只读.它可以防止用户选择不同的值,并且选中的值将始终在提交时发布.

                  I've faked readonly on a radio button by disabling only the un-checked radio buttons. It keeps the user from selecting a different value, and the checked value will always post on submit.

                  使用jQuery进行只读:

                  Using jQuery to make readonly:

                  $(':radio:not(:checked)').attr('disabled', true);
                  

                  这种方法也适用于使选择列表只读,但您需要禁用每个未选择的选项.

                  This approach also worked for making a select list readonly, except that you'll need to disable each un-selected option.

                  这篇关于为什么单选按钮不能“只读"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  keeping radio buttons checked after form submit(表单提交后保持选中单选按钮)
                  Styling radio button - not work in IE and Firefox(样式单选按钮 - 在 IE 和 Firefox 中不起作用)
                  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如何更改单选按钮标签文本?)
                  How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)

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

                        <tfoot id='DQ79H'></tfoot>

                              <tbody id='DQ79H'></tbody>
                            <legend id='DQ79H'><style id='DQ79H'><dir id='DQ79H'><q id='DQ79H'></q></dir></style></legend>