How to Remove/Find Word in TextBox Through java Script

How to Remove/Find Word in TextBox Through java Script

1. Java script code

  function ButtonDisplay_onclick() {

            var i;
           
var words = new Array();
            words[0] = 
"Rakesh";
            words[1] = 
"Rahul";
            words[2] = 
"Riyan";
           
var s = document.getElementById("DisplayTxt").value;
           
var s2 = document.getElementById("div_ID ").value; 
           
for (i = 0; i < words.length; i++) {
               
if (s.match(words[i]) == words[i]) {
                    document.getElementById(
"DisplayTxt").focus();
                    document.getElementById(
"DisplayTxt").value"";
                }

           }

}

2. HTML Code

<div id="div_ID">

        <input id="ButtonDisplay" type="button" value="Click On"onclick="return ButtonDisplay_onclick()" />        <input type="text" id="DisplayTxt" />
  
</div>
Ebook Download
View all
Learn
View all