-2

Is there a way to combine the following two event listeners into one statement?

$('.series input').on('change', do_something);
$('.series input').on('keyup', do_something);
David542
  • 104,438
  • 178
  • 489
  • 842

1 Answers1

5

Read the documentation of the tools you use.

.on( events [, selector ] [, data ], handler )

events

Type: String

One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".

So add a space between the events

$('.series input').on('change keyup', do_something);
epascarello
  • 204,599
  • 20
  • 195
  • 236