jquery add() method


  Translation results:

add

英[æd] 美[æd]

vt.Add; add; add explanation; include…

vi. Increase; do addition; accumulate; expand

n. Addition, addition operation; (the supplementary part of a report)

jquery add() methodsyntax

Function: add() method adds elements to the collection of matching elements.

Syntax 1: .add(selector)

Parameters:

##selector String value, indicating the selector expression to find elements to be added to the set of matching elements.
ParametersDescription

Syntax 2: .add(elements)

Parameters:

ParametersDescriptionelements One or more elements added to the matching element set.

Syntax 3: .add(html)

Parameters:

ParametersDescriptionhtml HTML fragment added to the set of matched elements.

Syntax 4: .add(jQueryObject)

Parameters:

ParametersDescriptionjQueryObject An existing jQuery object added to the matching element collection.

Syntax 5: .add(selector, context)

Parameters:

ParameterDescriptionselector String value, indicating the search for adding to the matching element set The selector expression for the element. context The position where the selector starts matching.

jquery add() methodexample

$("div").css("border", "2px solid red")
       .add("p")
       .css("background", "yellow");

Popular Recommendations