php - How to add a jQuery Listener for 2 events? -


i have event in table if clicked function fires, want same function fire if item on dropdown select option selected.

my working code table td if clicked is:

$('td[id^="tblcell"]').click(function() { ... ... ... }); 

how can add code first line same function executues if select changed?

something like:

$('td[id^="tblcell"]').click(function() or ('select[id^="selectlist"]').onchange(function() { 

but doesn't work due syntax error... correct way code this? (if possible).

i using php , latest jquery.

thanks

simply put code function , call in 2 seperate handlers.

$('td[id^="tblcell"]').click(dostuff); $('select[id^="selectlist"]').on('change', dostuff);  function dostuff(event) {     // code } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -