Get CSS class name in JavaScript - Javascript jQuery

Javascript examples for jQuery:CSS

Description

Get CSS class name in JavaScript

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
  <script type="text/javascript">
           $(document).ready(function() {
                var ddd="<p class='Box_title'>Heading text here...</p>";
                $('.container').append(ddd);
                console.log($('.container').children(':first-child').attr("class"));
        });/*  w ww .  ja va2s .com*/
       
      </script> 
 </head> 
 <body> 
  <div class="container"> 
  </div>  
 </body>
</html>

Related Tutorials