JQuery - Get the CSS class of an element -


i have anchor follows:

<a href="#" class="menu">text</a> 

how can css class of anchor using jquery?

so in case "menu".

i able add , remove css classes can't find way css classes of element. can ?

use the native property :

$(selectororelement).get(0).classname 

note it's answered use attr('class'). not there no gain in using complex function instead of native dom property it's also, quite naturally, slower. see jsperf


Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -