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

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -