YUI 3.9 Start

YUI 3.9 Start

HTML

<script src="http://yui.yahooapis.com/3.9.0/build/yui/yui.js"></script>
<div class="aa">
    <input id='myinput'>
</div>

JavaScript

YUI().use('node-event-simulate', function(Y) {

    var node = Y.one(".aa");
    node.focus();
    //simulate a keydown on the A key
    node.simulate("keydown", { keyCode: 46, value: "a" });

    //simulate a keyup on the A key
    node.simulate("keyup", { keyCode: 46, value: "a" });

    //simulate typing "a"
    node.simulate("keypress", { keyCode: 46, value: "a" });
});