I have this code:
$j(\"#regfname\").keypress(function () { alert(\'Handler for .keypress() called.\'); });
and want to execute only once..
You can use the jQuery one() method to only execute the event once per element.
$j("#regfname").one("keypress", function () { alert('Handler for .keypress() called.'); });
You want to use the one function:
$j('#regfname').one('keypress', function(){...});