please see this thread first :
How Simulate “Enter Key Hit” Using With Both Javascript & Jquery
and check out this comment in that thread :
@RobG :
you can dispatch a keypress event with appropriate parameters from a particular target element, however browsers may not treat it exactly like user input. You can't fool them, they know where the event came from. See also Creating and triggering events.
@RobG was right.
browsers can recognize our simulation by these codes:
var e = jQuery.Event("keypress");
e.which = 13; //choose the one you want
e.keyCode = 13;
$("#theInputToTest").trigger(e);
is there a way to simulate that just like a HUMAN DO?