RSS Feed/News Simulate a key in a field

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
23,703
Points
823

Reputation:

Here what I have:

There is an input field and a button.
I click on the button, and a text "example" is copied to field.

[example]

I also gave the focus to that field.
And now I have to press [space] to have a key-event on my field (then something else happens)
But I am lazy, I want to have this key-event also by script:

Code:

Code:
    var e = jQuery.Event("keydown");
     e.which = 32;
     e.ctrlkey = false;
     $(document).trigger(e);

This does not work.

Any idea, what I can do instead?

Continue reading...
 
Status
Not open for further replies.
Top