+ 1
Can we do 2 events with the same code?
Hi, is it possible to do 2 events and using the same code on the 2 events without always copy and paste on each events? https://code.sololearn.com/WGUbtC2RFEno/?ref=app
4 Answers
+ 2
var myKeyUpHandler= function(){
......
};
myVar1.keyup(myKeyUpHandler);
myVar2.keyup(myKeyUpHandler);
+ 2
Thank you :)
+ 1
function do_something(_this){
// do something with _this
alert("test");
}
$("input").live("keyup", function({
do_something($(this));
});
$("select").live("change", function({
do_something($(this));
});
0
đđđ