jquery-replace-class

    0.0.1 • Public • Published

    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/);

    Keywords

    none

    Install

    npm i jquery-replace-class

    DownloadsWeekly Downloads

    6

    Version

    0.0.1

    License

    BSD-2-Clause

    Last publish

    Collaborators

    • moudy