Is it possible to combine two different element types, handling the same function?

Is it possible to combine two different element types, handling the same function?

Hello,

I have an element type Input and an Select like:
  1. <input type= "text" class="filter_field" id=filter_anam" name="filter_anam" value="filter op achternaam">
  2. <select class="filter_field form-control" id=filter_catg" name="filter_catg">
I have created for each a jQuery function which is working:
  1. jQuery('.filter_field').keyup(function(){
                                filter_data();
                            });
And
  1. jQuery('select[name=filter_catg]').change(function() {
                                filter_data()

                                console.log('Waarde select: ' + jQuery(this).val());
                            });
Is it possible to combine these two different element types functions to one function?

Thanks in advance,

Nico