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.