Can I write this with less code, also is .click(function preferred for mobile or should I use something else?
$('.myclass a').removeClass('class1');
$('.myclass a').click(function() {
return false;
});
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use Chaining. Also, .click works fine for mobile, but you should always test it. There are some exceptions.
Don’t use jQuery Mobile just for click handling, the excessive overhead for just a click is not worth it. Only use it if you have a need for more mobile integration, and if you do, try to only load it when it’s needed for mobile.