I want to add 'a' to the value of input when click a button
Here is my code(with jQuery 1.4.4):
$("#button").click(function(){
$("#input").trigger("focus");
var e = jQuery.Event("keypress");
e.which = '97';
$("#input").trigger(e);
})
However, it seems only to trigger 'focus' event ,but failed to 'keypress'.
Why not just append to
val()
?