jQuery Tip: Binding Multiple Events

When you need to have an element respond to multiple events (i.e. desktop and mobile), you can use the bind() jQuery  method.
JavaScript
$(‘#user_id’).bind(‘mousedown’, ‘touchstart’, function (e) { // your code here });
1
2
3
4
$(‘#user_id’).bind(‘mousedown’, ‘touchstart’, function (e) {
        
      // your code here  
   });
August 19, 2014August 20, 2014
bind eventsjQuery
Post navigation
← Formatting Tables Quickly
CSS Tip: Adjacent Sibling Selector vs nth-child ‘
*
*
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Proudly powered by WordPress | Theme: Isola by WordPress.com.

Aly Chiman

Aly Chiman is a Blogger & Reporter at AlyChiTech.com which covers a wide variety of topics from local news from digital world fashion and beauty . AlyChiTech covers the top notch content from the around the world covering a wide variety of topics. Aly is currently studying BS Mass Communication at University.

Leave a Reply

Your email address will not be published.