1.3.8 • Published 2 years ago

jquery_selectors_mergez v1.3.8

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

NPM Downloads

here

Purpose

The purpose of this package is to allow users to quickly select and change various elements.

JQuery Selectors

Directions

  1. Install the package
npm install jquery-selectors-mergez 
  1. In your html document, import the script (make sure to import it after your JQuery script, and before your javascript file)
<script src="./node_modules/jquery_selectors_mergez"></script>
  1. Create javascript file - make sure to put all your jquery selectors after the instantiator - e.g.,
$(() => {
 mergeE.insertAsFirst($("[data-child=1] .grandchild"), $("<div>new Element</div>"))
})
<script src="yourScript.js"></script>

MergeElements

Kind: global class
Date: 2022-02-01

new MergeElements()

a way to insert into elements

mergeElements.insertAsFirst()

mergeE.insertAsFirst($("data-child=1 .grandchild"), newElement)

Kind: instance method of MergeElements
Example

let newElement = $("<div>insert me as first</div>")
         mergeE.insertAsFirst($("[data-child=1] .grandchild"), newElement)

mergeElements.wrapEach()

mergeE.wrapEach($(".dropdown > *"), newWrapper)

Kind: instance method of MergeElements
Example

let newWrapper = $("<div class='box'></div>")
         mergeE.wrapEach($(".dropdown > *"), newWrapper)

mergeElements.addToEndOfNthElement() ⇒ any

mergeE.addToEndOfNthElement(".dropdown-item", 3, newItem)

Kind: instance method of MergeElements
Date: 2022-02-01
Example

// index works the same as in js, starts with 0
  let newItem = $("<div>newdropdown</div>")
        mergeE.addToEndOfNthElement(".dropdown-item", 3, newItem)

mergeElements.addToBegOfNthElement() ⇒ any

mergeE.addToBegOfNthElement(".dropdown-item", 3, newItem2)

Kind: instance method of MergeElements
Example

// index works the same as in js, starts with 0
         let newItem2 = $("<div>newdropdown</div>")
         mergeE.addToBegOfNthElement(".dropdown-item", 3, newItem2)

mergeElements.insertBefore() ⇒ any

Kind: instance method of MergeElements
Date: 2022-02-02
Example

let newDropdown1 = $(`<a href="#" class="dropdown-item" data-id='0'>og0</a>`)
         mergeE.insertBefore($("[data-id=1]"), $("<div>insert before other element</div>"))

mergeElements.insertAfter() ⇒ any

let newDropdown = $(<a href="#" class="dropdown-item" data-id='6'>6</a>) mergeE.insertAfter($("data-id=5"), $("insert after"))

Kind: instance method of MergeElements
Date: 2022-02-02

mergeElements.insertAsLast(element, child) ⇒ any

insertAsLast($(".parent"), $(".child"))

Kind: instance method of MergeElements
Date: 2022-01-31

ParamType
elementany
childany

mergeElements.findAllFirstOfElement() ⇒ any

findAllFirstOfElement(parent, first)

Kind: instance method of MergeElements

mergeElements.getAllElementsWithinParent(parent, selector) ⇒ any

mergeE.getAllElementsWithinParent($(".parent"), $(".selectorWithinParent"))

Kind: instance method of MergeElements
Date: 2022-02-06

ParamType
parentany
selectorany

mergeElements.getAllTextWithinElement() ⇒ any

Kind: instance method of MergeElements
Example

//     let getText = mergeE.getAllTextWithinElement("[data-parent='2']")
getAllTextWithinElement(element)

mergeElements.getElementBasedOnSibling() ⇒ any

Kind: instance method of MergeElements
Example

mergeE.getElementBasedOnSibling("[data-greatgrandchild='2']", ".great-grandchild", changeToGreen)

mergeElements.insertAsFirstIntoNthElement() ⇒ any

Kind: instance method of MergeElements
Example

let newLastInsertion2 = $("<div>yoyoas last</div>")
         mergeE.insertAsFirstIntoNthElement(".grandchild", 2, $("<div>insert</div>"))

mergeElements.insertAsLastIntoNthElement(nthElement, lastElementInNth) ⇒ any

insertAsLastIntoNthElement(".parent", 2, $("insert"))

Kind: instance method of MergeElements
Date: 2022-01-31

ParamType
nthElementany
lastElementInNthany

mergeElements.changeParent()

Kind: instance method of MergeElements
Example

mergeE.changeParent("[data-greatgrandchild='2']", ".parent", changeToPink)
1.3.7

2 years ago

1.3.6

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.8

2 years ago

1.3.0

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago