How to make this correct?
if( $(this) == $(".className") ){
alert("Yes!");
}
and the NOT…
if( $(this) != $(".className") ){
alert("Yes!");
}
Thank you
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.
What your code would do is to compare a jQuery object containing one element with another jQuery object containing all elements with a specific class, so that would supposedly (i.e. if it would have worked) be true if the element has that class, and it’s the only element with that class. I don’t think that’s what you want to do…
If you want to check if the element has a class: