Access a label value via innerText - Javascript DOM

Javascript examples for DOM:Element innerText

Description

Access a label value via innerText

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
         function getLabelValue()
         {/*from   w  ww.  j  av a2s. co  m*/
            console.log(document.getElementById("labelvalue").innerText);
         }
      
      </script> 
   </head> 
   <body> 
      <html:form> 
         <label id="labelvalue">FOOOOOOO</label> 
         <input type="button" onclick="getLabelValue()"> 
      </html:form>  
   </body>
</html>

Related Tutorials