C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Javascript - innerTextThe innerText property can be used to write the dynamic text on the html document. Here, text will not be interpreted as html text but a normal text.
It is used mostly in the web pages to generate the dynamic content such as writing the validation message, password strength etc. Javascript innerText ExampleIn this example, we are going to display the password strength when releases the key after press. <script type="text/javascript" > function validate() { var msg; if(document.myForm.userPass.value.length>5){ msg="good"; } else{ msg="poor"; } document.getElementById('mylocation').innerText=msg; } </script> <form name="myForm"> <input type="password" value="" name="userPass" onkeyup="validate()"> Strength:<span id="mylocation">no strength</span> </form> Output of the above example
Next TopicJavascript Form Validation
|