• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details
Home / Archives for CSS

CSS

Get and Set Classes On An Element

Get and Set Classes On An Element

Get all of the classes on an element as a string, add a class or classes, or completely replace or remove all classes.

CSS

Add, remove, toggle, and check for the presence of a class

Add, remove, toggle, and check for the presence of a class.

Here are some handy, simple ways to manipulate CSS classes.

CSS

Find all matching elements on a page with document.querySelectorAll()

Find all matching elements on a page

Find all matching elements on a page. You can use any valid CSS selector.

CSS

Apply a CSS animation to an element with JavaScript

Apply a CSS animation to an element with JavaScript

A helper function to apply a CSS animation to an element with JavaScript.

CSS

Select an element or list of elements

Select an element or list of elements

Select an element or elements by given ID, class name, tag name, or CSS selector.

CSS

Check If an Element is Visible in the Viewport

Check If an Element is Visible in the Viewport

In this tutorial, you’ll learn how to check if an element is visible in the viewport using JavaScript.

CSS

Replace a Class of an Element

Replace a Class of an Element

To replace a class of an element with a new one, you use the replace() method of the classList property of the element.

CSS

Check If an Element contains a Class

Check If an Element contains a Class

To check if an element contains a class, you use the contains() method of the classList property of the element.

CSS

Toggle a Class of an Element

Toggle a Class of an Element

To toggle a class of an element, you use the toggle() method of the classList property of the element.

CSS

Remove a Class from an Element

Remove a Class from an Element

To remove a class from an element, you use the remove() method of the classList property of the element.

CSS

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to Next Page »

Primary Sidebar

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2025 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers