I currently working on Chrome lastest version. I have the following simple html code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<html>
<input id="inputfield" type = "textfield">
</html>
</body>
</html>
then using javascript i am first trying to set the text of the field which is ok, then focus it and then cause a space key press.
textbox = document.getElementById("inputfield")
textbox.value = "word";
var evt = document.createEvent("KeyboardEvent");
evt.initKeyboardEvent(
"keyup",
true,
true,
window,
false,
false,
false,
false,
32,
0
);
textbox.focus();
textbox.dispatchEvent(evt);
but there is no focus happening and the last line just returns true; I am executing the code through the console of chrome i dont know if that would make a difference.
Thank you