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

    1. <tfoot id='Zqo99'></tfoot>

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

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

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

        通过 JavaScript 检查单选按钮组的值?

        时间:2023-10-21
      2. <small id='M38wG'></small><noframes id='M38wG'>

        1. <tfoot id='M38wG'></tfoot>

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

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

                  <legend id='M38wG'><style id='M38wG'><dir id='M38wG'><q id='M38wG'></q></dir></style></legend>
                    <tbody id='M38wG'></tbody>
                  本文介绍了通过 JavaScript 检查单选按钮组的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这可能看起来很愚蠢而且非常愚蠢,但我似乎无法弄清楚如何通过 JavaScript 在我的 HTML 表单中检查单选按钮组的值.我有以下代码:

                  This may seem silly and downright stupid but I can't seem to figure out how to check the value of a radio button group in my HTML form via JavaScript. I have the following code:

                  <input type="radio" id="genderm" name="gender" value="male" />
                  <label for="genderm">Male</label>
                  <input type="radio" id="genderf" name="gender" value="female" />
                  <label for="genderf">Female</label>
                  

                  如何通过 JavaScript 检索 gender 的值?

                  How do I retrieve the value of gender via JavaScript?

                  推荐答案

                  如果你使用 jQuery 之类的 javascript 库,这很容易:

                  alert($('input[name=gender]:checked').val());
                  

                  此代码将选择带有 gender 名称的 checked 输入,并获取它的 value.是不是很简单?

                  This code will select the checked input with gender name, and gets it's value. Simple isn't it?

                  现场演示

                  这篇关于通过 JavaScript 检查单选按钮组的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在采取行动的情况下获取单选按钮的选定值 下一篇:如何在html中自定义单选按钮

                  相关文章

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

                      • <bdo id='6BPDr'></bdo><ul id='6BPDr'></ul>
                      <tfoot id='6BPDr'></tfoot>

                    1. <small id='6BPDr'></small><noframes id='6BPDr'>