Add a HTML class to element with .addClass()

.addClass()


Description: Add a HTML class to elements.


Example:

<!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>addClass demo</title>
      <script src="http://code.bitsycode.com/bitsycode-latest.min.js"></script>
      <style type="text/css">
         .yellow {
            background-color: yellow;
         }
      </style>
    </head>
    <body>
      
      <p>This is an example</p>
      
      <script>
         
         bitsyCode.ready(function(){
            bitsyCode('p').addClass("yellow");
         })
         
      </script>
     
    </body>
    </html>

Preview:

This is an example

  • Usage

    • How to use:

      Set HTML classes to elements using .addClass()

    • USAGE:

      bitsyCode('element').addClass("className");
  • Options

    • What options are there:

      There are no options for this method.

  • Returns

    • Returns: No return type

      This method does not need to return any type.

Share