I want to do some actions when class .smth is clicked
$('.smth').click(function() {
and when key is pressed:
$('.txt').bind('keypress', function(e) {
I want to do the same action, so how can I use them both with OR or something like that?
$('.log').click.or.$('.txt').bind('keypress', function(e) {
?
THank you.
If this was the same collection of elements you could use:
But as it’s different elements you’ll have to follow Felix advice and write a function then attach it as the event handler.