How do I simulate a keypress into a input tag without jQuery? I looked at Simulate keypress without jquery but it didn't seem to help. Example of what I'm trying to do:
<inputobject>.simulatekeypress('a');
Please do not submit any jquery answers.
How do I simulate a keypress into a input tag without jQuery? I looked at Simulate keypress without jquery but it didn't seem to help. Example of what I'm trying to do:
<inputobject>.simulatekeypress('a');
Please do not submit any jquery answers.
function simulatekeypress(char) {
document.getElementById("input").value += char;
}
// simulatekeypress("a");
Input: <input id="input" value="123" />
<p>
<button onclick="simulatekeypress('a');">
Simulate key press
</button>
</p>