It is possible to use multiple selectors within $()
.
$('#element1, #element2').keyup(function(){ getData() });
or shorter
$('#element1, #element2').keyup(getData);
If you want to associate the .change()
event with multiple select
fields, then give all select
common class
<select class="myselect"></select> <select class="myselect"></select> <select class="myselect"></select> $('.myselect').on('change', function() { });
source share