javascript - JS - multiple eventlisteners and dynamic arguments in one line of code -


i'm trying head around adding multiple eventlisteners dynamic arguments in 1 line of code. more specific want input[name='txtname'] call function when blur or keyup detected. want both events call same function "e" main argument (e includes element fires event).

how have be:

$("input[name='txtname']").blur.keyup.callthisfunctionwitharguments(e,20,40); 

this code have @ moment, think can shorter:

$("input[name='txtname']").blur(function(e){callotherfunction(e,20,40)}); $("input[name='txtname']").keyup(function(e){callotherfunction(e,20,40)}); 

thanks in advance

it may helpful you.

$("input[name='txtname']").bind('blur keyup', function(e){   callotherfunction(e,20,40); }); 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -