Socket
Book a DemoInstallSign in
Socket

jquery-replace-class

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-replace-class

Replace one or more classes on an element

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Build Status

jQuery.replaceClass

Remove one or more classes that match a string or regular expression and optionally add a class. Usefull when you need to swap out classes the have the same prefix like $('#el').replaceClass(/^animate-/, 'animate-out');.

Install

npm install jquery-replace-class

Usage

// inject jQuery so it can add the replaceClass function to jQuery.fn
require('jquery-replace-class')(jQuery);

$('#el').replaceClass('foo', 'bar');
$('#el').replaceClass(/^f/, 'bar');

// Or just remove any class starting with 'f'
$('#el').replaceClass(/^f/);

FAQs

Package last updated on 22 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts