I have the following that works:
$('textarea').keypress(function(e) { if (e.keyCode == '13') { alert('code'); } });
But I want to call the same thing when the page loads, I tried the following, but this does not work:
var e = jQuery.Event("keypress"); e.which = 13; // Enter $('textarea').trigger(e);
NOTE. I want my first code cut off, I DO NOT want to delete it.
jquery
dzumla011
source share