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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -