in FF, i've used this code:
if (keyCount == lineLimit) { // method in FF, no Chrome var mock = document.createEvent("KeyboardEvent"); // or KeysEvent mock.initKeyEvent("keypress",true,true,null,false,false,false,false,14,0); var x = document.getElementById('InputCategory'); // rise height before Enter $(this).height(div_height + font_height + offset_height); // mock Enter x.dispatchEvent(mock); // init keyCount keyCount = 0; }
it works, but could not be effective on webkit-based browsers like chrome.
so i asked google and found keyboard event is one of the DOM Level 3 events,here is an aticle: http://www.w3.org/TR/DOM-Level-3-Events/
then i knew /* initKeyboardEvent / is not supported on chrome & safari, / initUIEvent */ i've tried, it didn't work also.
Do virtual keyboard events reall can be simulated on chrome ? plesase help me :)
See Question&Answers more detail:os