Methods

attr

attr( attributeName )

Get the value of an attribute for the first element in the set of matched elements.

attr( attributeName, value )

Set one or more attributes for the set of matched elements.

attr( map )

map: A hash ref of attribute-value pairs to set.

attr( attributeName, sub { my ( $index, $attr ) = @_; } )

Check jQuery API

http://api.jquery.com/attr/

removeAttr

Remove an attribute from each element in the set of matched elements.

Check jQuery API

http://api.jquery.com/removeAttr/

addClass

Adds the specified class(es) to each of the set of matched elements.

addClass( string )

One or more class names to be added to the class attribute of each matched element.

addClass( sub { my ($index,$this,$currentClass) = @_; } )

A function returning one or more space-separated class names to be added. Receives the index position of the element in the set and the old class value as arguments.

Check jQuery API

http://api.jquery.com/addClass/

removeClass

Remove a single class, multiple classes, or all classes from each element in the set of matched elements.

removeClass( string )

One or more space-separated classes to be removed from the class attribute of each matched element

addClass( sub { my ($index,$this,$currentClass) = @_; } )

A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments.

Check jQuery API

http://api.jquery.com/removeClass/

toggleClass

Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.

toggleClass( string )

One or more class names (separated by spaces) to be toggled for each element in the matched set.

toggleClass( className, switch )

className: One or more class names (separated by spaces) to be toggled for each element in the matched set.

switch: A boolean value to determine whether the class should be added or removed.

addClass( sub { my ($this,$index,$currentClass) = @_; }, switch )

A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments.

switch: A boolean value to determine whether the class should be added or removed.

Check jQuery API

http://api.jquery.com/toggleClass/

hasClass

Determine whether any of the matched elements are assigned the given class.

hasClass( string )

String: The class name to search for.

Check jQuery API

http://api.jquery.com/hasClass/

val

Get the current value of the first element in the set of matched elements.

val()

Get the current value of the first element in the set of matched elements.

val( string )

Set the value of each element in the set of matched elements.

val( sub{ my ($index,$this,$value) = @_; } )

A function returning the value to set.

Check jQuery API

http://api.jquery.com/val/

id

return element id

find

Get the descendants of each element in the current set of matched elements, filtered by a selector.

find( selector )

Check jQuery API

http://api.jquery.com/find/

css

insert css style(s) to the selected Element

css({style=>value, style2 => value2, ...});

set list of hashref styles to the selected element(s)

css('style','value');

set one style to the selected element(s)

data

Store arbitrary data associated with the specified element. Returns the value that was set.

$obj->data( element, key, value )

or

$element->data( key, value )

element : The DOM element to associate with the data.

key : A string naming the piece of data to set.

value : The new data value.

Check jQuery API

http://api.jquery.com/jQuery.data/

filter

Reduce the set of matched elements to those that match the selector or pass the function's test.

filter( selector )
filter( function )
filter( element )
filter( jQuery object )

Check jQuery API

http://api.jquery.com/filter/

map

Translate all items in an array or object to new array of items.

http://api.jquery.com/jQuery.map/

html

html()

Get the contents of any element. If the selector expression matches more than one element, only the first one's HTML content is returned.

html( htmlString )

htmlString: A string of HTML to set as the content of each matched element.

html(sub {my ($this,$index,$oldhtml) = @_;} );

A CODE ref returning the HTML content to set. Receives element, the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content.

same as jQuery .html( function(index, oldhtml) )

Check jQuery API

http://api.jquery.com/html/

text

text()

The result of the text() method is a string containing the combined text of all matched elements.

text( textString )

textString: A string of text to set as the content of each matched element.

text(sub { my ($index,$oldtext,$element) = @_;} );

A CODE ref returning the text content to set. Receives the element, index position of the element in the set and the old text value as arguments.

same as jQuery .text( function(index, oldtext) )

Check jQuery API

http://api.jquery.com/html/

append

Insert content, specified by the parameter, to the end of each element in the set of matched elements.

append( content )

content: An element, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.

append( sub { my ($index,$this,$html) = @_; } )

A CODE ref that returns an HTML string to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments.

same as jQuery .append( function(index, html) )

Check jQuery API

http://api.jquery.com/append/

prepend

Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.

prepend( content )

content: An element, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements.

prepend( sub { my ($this,$index,$html) = @_; } )

A CODE ref that returns an HTML string to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments.

same as jQuery .prepend( function(index, html) ) function

Check jQuery API

http://api.jquery.com/prepend/

appendTo

Insert every element in the set of matched elements to the end of the target.

appendTo( Target )

Target: A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter.

Check jQuery API

http://api.jquery.com/appendTo/

prependTo

Insert every element in the set of matched elements to the beginning of the target.

prependTo( Target )

Target: A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter.

Check jQuery API

http://api.jquery.com/prependTo/

add

Add elements to the set of matched elements.

add( selector )

selector: A string containing a selector expression to match additional elements against.

add( selector, context )

selector: A string containing a selector expression to match additional elements against.

context: Add some elements rooted against the specified context.

add( element )

elements: one or more elements to add to the set of matched elements.

add( <html> )

html: An HTML fragment to add to the set of matched elements.

Check jQuery API

http://api.jquery.com/add/

andSelf

Add the previous set of elements on the stack to the current set.

Check jQuery API

http://api.jquery.com/andSelf/

next

Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.

next( [ selector ] )

Check jQuery API

http://api.jquery.com/next/

nextAll

Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.

nextAll( [ selector ] )

Check jQuery API

http://api.jquery.com/nextAll/

nextUntil

Get all following siblings of each element up to but not including the element matched by the selector.

nextUntil( [ selector ] )

Check jQuery API

http://api.jquery.com/nextUntil/

parent

Get the parent of each element in the current set of matched elements, optionally filtered by a selector.

parent( [ selector ] )

Check jQuery API

http://api.jquery.com/parent/

children

Get the children of each element in the set of matched elements, optionally filtered by a selector.

children( [selector] )

Check jQuery API

http://api.jquery.com/children/

closest

Get the first ancestor element that matches the selector, beginning at the current element and progressing up through the DOM tree.

closest( selector )
closest( selector, context )

Check jQuery API

http://api.jquery.com/closest/

contents

Get the children of each element in the set of matched elements, including text and comment nodes.

contents()

Check jQuery API

http://api.jquery.com/contents/

end

End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.

end()

Check jQuery API

http://api.jquery.com/end/

eq

Reduce the set of matched elements to the one at the specified index.

eq( index )
eq( -index )

Check jQuery API

http://api.jquery.com/eq/

first

Reduce the set of matched elements to the first in the set.

first( selector )

Check jQuery API

http://api.jquery.com/first/

last

Reduce the set of matched elements to the final one in the set.

Check jQuery API

http://api.jquery.com/last/

has

Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.

has( selector )
has( contained )

Check jQuery API

http://api.jquery.com/has/

contains

is

Check the current matched set of elements against a selector and return true if at least one of these elements matches the selector.

is( selector )

Check jQuery API

http://api.jquery.com/is/

not

Remove elements from the set of matched elements.

not( selector )
not( function )
not( element )
not( jQuery object )

Check jQuery API

http://api.jquery.com/not/

replaceWith

wrap

unwrap

wrapInner

wrapAll

after

before

insertBefore

insertAfter

clone

length

returns number of matched elements

remove