Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to Remove/Find Word in TextBox Through java Script
WhatsApp
Rajesh Gonugunta
4y
5.6
k
0
2
25
Blog
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
>
Up Next
Accessing View Bag And View Data Value In External Java Script File
Ebook Download
View all
Frontend Developer Interview Questions and Answers
Read by 989 people
Download Now!
Learn
View all
Membership not found