-1

I have one jquery event for two elements, 1 textbox and 1 select option.

$('#txtInput').keyup(function() {
    some_function();
});

$('#sltInput').change(function() {
    some_function();
});

But i wan't something like:

$('#txtInput').keyup('#sltInput').change(function() {
   some_function();
});

Can do it?

Hask
  • 13
  • 4
  • What you're asking for is called [research](http://api.jquery.com/bind/#multiple-events) and you have not done yours. – LJᛃ Jan 13 '15 at 04:11
  • possible duplicate of [jQuery multiple events to trigger the same function](http://stackoverflow.com/questions/2534089/jquery-multiple-events-to-trigger-the-same-function) – LJᛃ Jan 13 '15 at 04:16

1 Answers1

0

Delegate multiple events, on multiple elements.

$('form').on('keyup change', '#sltInput, #txtInput'), function(){

});

And the associated jsFiddle

Ohgodwhy
  • 49,779
  • 11
  • 80
  • 110