Skip to content

heyymarco/jquery-plugin-chain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published