Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
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
Voice of a Developer: JavaScript From Scratch
Read by 10.9k people
Download Now!
Learn
View all
Membership not found