Getting CSS class names with js
To get CSS class names from DOM element simply use:
$(‘#dom-id’).attr(‘class’);
So it's simple as it looks ;)
Written by OfcaPL
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
iatek
512.9K
praveenvijayan
482.6K
Filed Under
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#