• <legend id='C20nM'><style id='C20nM'><dir id='C20nM'><q id='C20nM'></q></dir></style></legend>

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

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

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

        Javascript如何更改单选按钮标签文本?

        Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)

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

            <legend id='vZrev'><style id='vZrev'><dir id='vZrev'><q id='vZrev'></q></dir></style></legend>
              <tbody id='vZrev'></tbody>
          1. <tfoot id='vZrev'></tfoot>

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

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

                  本文介绍了Javascript如何更改单选按钮标签文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I want to change the text of the label which is associated with the radiobutton id="male". I have tried various ways to do it, but i can't make it work. I want to change the text "Male" in the label associated to the radio button.

                    <input type="radio" name="sex" id="male" value="male">
                          <label for="male">Male</label>
                    </input>
                  
                   <input type="button" value="Submit" onclick = test()>
                  
                  <script>
                  
                  function test()
                  {
                     var r = document.getElementById("male");
                     r.nextSibling.data = "adaS";
                  //  r.nextSibling.nodeValue = "adaS";     // have tried all these ways
                  //  r.childNodes[0].value= "adaS";
                  //  r.childNodes[0].innerHTML= "adaS";
                  //   r.parentNode.childNodes[1].innerHTML= "adaS";
                  
                  }
                  
                  </script>
                  

                  please suggest some working way to change the text "Male" in the label.

                  解决方案

                  You can use

                  var r = document.getElementsByTagName("label")   
                  

                  to select all the label element in your page and then use

                  r[0].innerHTML ="new text" 
                  

                  to select first label and set the text to "next text" in your test() function

                  这篇关于Javascript如何更改单选按钮标签文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  在开发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中的序数)
                • <i id='OT0xg'><tr id='OT0xg'><dt id='OT0xg'><q id='OT0xg'><span id='OT0xg'><b id='OT0xg'><form id='OT0xg'><ins id='OT0xg'></ins><ul id='OT0xg'></ul><sub id='OT0xg'></sub></form><legend id='OT0xg'></legend><bdo id='OT0xg'><pre id='OT0xg'><center id='OT0xg'></center></pre></bdo></b><th id='OT0xg'></th></span></q></dt></tr></i><div id='OT0xg'><tfoot id='OT0xg'></tfoot><dl id='OT0xg'><fieldset id='OT0xg'></fieldset></dl></div>
                    <tbody id='OT0xg'></tbody>
                • <small id='OT0xg'></small><noframes id='OT0xg'>

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

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

                            <tfoot id='OT0xg'></tfoot>