TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How to Remove/Find Word in TextBox Through java Script
Rajesh Gonugunta
May 12, 2020
5.5
k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
This blog defines how to remove/find word in TextBox through java Script.
How to Remove/Find Word in TextBox Through javaScript
1. Javascript 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
>
Next Recommended Reading
Accessing View Bag And View Data Value In External Java Script File