I need to trigger 2 events in same one but from different HTML elements. What I mean is that I have search text box and a search button. I need to display search results on keyup inside the search text box OR when the search button is clicked.
I found this answer on stack overflow but it is meant to be used by just one element and several events:
$('#element').on('keyup keypress blur change', function(e) {
// e.type is the type of event fired
});
Is it possible or should I duplicate my script but change the event for each element ?
What I am using is:
$('#searchBtn').on('click',function()
{
surfData();
});
$('#searchTxt').on('keypress',function()
{
surfData();
});