Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger Change event and keyup event in select element

I have some codes that should be run when a select element changes.I do it with jquery in this way:

$("#myselect").change(function() {
    .......
});

But I want these codes run also when user change the select using keyword arrows. As i found the event for this purpose is 'keyup' . So will be :

$("#myselect").keyup(function() {
   .......
});

How can i combine these two event?

like image 763
hd. Avatar asked Sep 06 '11 07:09

hd.


1 Answers

You can use .bind() to combine them:

$("#myselect").bind("change keyup", function(event){
   //Code here
});

See reference here.

like image 107
AlexBay Avatar answered Nov 09 '22 10:11

AlexBay