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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rupesh Kahane
102
19.1k
4.2m
programmatically press keyboard key on button click event
Mar 24 2017 6:48 AM
I have one textbox & button. On button click event I have too show some keyboard value (example I have to show number 2 into a textbox)
How can I do a javascript code which will automatically press a key & show a text into a textbox.
I tried with below code. Suggest me something.
Thanks in advance.
<input type=
"text"
id=
"myInputTextBoxId"
value=
""
>
<button id=
"myButton"
type=
"button"
>Generate Text</button>
<script>
document.getElementById(
"myButton"
).addEventListener(
"click"
,
function
() {
var
press = jQuery.Event(
"keypress"
);
press.which = 50;
$(
'#myInputTextBoxId'
).trigger(press);
$(
'#myInputTextBoxId'
).focus();
});
</script>
Reply
Answers (
3
)
Source Error: [No relevant source lines] using kendo UI
why we need to copy constring from dll in to web project