I want to get the class name using jQuery
And if it has an id
<div class="myclass"></div>
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.
After getting the element as jQuery object via other means than its class, then
should do the trick. For the ID use
.attr('id').If you are inside an event handler or other jQuery method, where the element is the pure DOM node without wrapper, you can use:
Both are standard DOM methods and well supported in all browsers.