jquery-plugin-chain

1.0.9 • Public • Published

What is this?

A jQuery plugin for simplifying chain operation.

Installation

npm install jquery-plugin-chain --save

Usage

ES6 JavaScript

import $ from "jquery";
import "jquery-plugin-chain";


$(".something, .someone")
.css({
    color: "black";
    backgroundColor: "pink"
})
.chain(function(){
    let count = this.length;
    if (count % 2 == 0) {
        this.attr("even", "even");
        return this;
    } else {
        return this.filter(".important-feature");
    }
})
.addClass("yeah")
;

TypeScript

import $ from "jquery";
import "jquery-plugin-chain";


$(".something, .someone")
.css({
    color: "black";
    backgroundColor: "pink"
})
.chain(function(this: JQuery<HTMLElement>){
    let count = this.length;
    if (count % 2 == 0) {
        this.attr("even", "even");
        return this;
    } else {
        return this.filter(".important-feature");
    }
})
.addClass("yeah")
;

Package Sidebar

Install

npm i jquery-plugin-chain

Weekly Downloads

0

Version

1.0.9

License

ISC

Unpacked Size

9.41 kB

Total Files

5

Last publish

Collaborators

  • heymarco