Answer the question
In order to leave comments, you need to log in
How to simulate keystrokes in NW.js by Input?
There is an application on NW.js with input.
If, for example, via Jquery change $('input').val('123'); and press the send button, the default value is sent, and the val function is ignored.
But if you poke the handles on the keyboard and write 123 then send, then the value is sent.
How can NW.js simulate a specific key press on an html Input element?
Tried module Node Key sender
Didn't work, event ks.sendKey('a'); does not happen, no error, etc.
So how to simulate keyboard output in NW.js ?
var ks = require('node-key-sender');
ks.sendKey('a');
$(function() {
$("input").select(function(){
ks.sendKey('a');
});
$("button").click(function(){
$("input").trigger("select");
});
});
Answer the question
In order to leave comments, you need to log in
First, the value set with .val() is sent just fine.
jsfiddle.net/anton4ept/0gm8qh6c if
you want - through a button, if you want - through javascript.
Second, do you only have one input per page?
$("input") selects all inputs and you need to use either indexes ($("input")), or $("input").each() or refine the selector, for example, selecting by id.
That's why it doesn't work.
And nw has nothing to do with it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question