Javascript examples for DOM:Element className
Get second class from two available with jQuery
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(window).load(function(){//from w ww.j av a2s .c o m var elem = document.getElementById('test'); console.log(elem.className.split(' ')); }); </script> </head> <body> <div id="test" class="foo bar"></div> </body> </html>