apply substring to results from input text field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

apply substring to results from input text field

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
function subStringIt(){//from  ww  w  .ja va  2  s  .  c om
    var wholeStr = document.getElementById("inputString").value;
    var subStr = wholeStr.substring(1, wholeStr.length);
    console.log(subStr);
}

      </script> 
   </head> 
   <body> 
      <input type="text" id="inputString"> 
      <input type="button" id="subIt" value="substring it" onclick="subStringIt()">  
   </body>
</html>

Related Tutorials