Search within TutorialsPark

Jquery Mapping


Learn the map method to apply a function to each item in an array.


Mapping the Selection using Jquery Method map()

The jQuery Method map() is used to provide a flexible way to use one jQuery object as a means to create another.

A function is passed to the map() method, and then this function is called for every element in the source jQuery Object, and then the HTMLElement object returned from the function are included in the resultant jQuery object.

Example: Mapping the selection using jQuery Method map()

Give it a TRY! » Note: The $.map() method applies a function to each item in an array.


Testing the Selection using Method is()

The jQuery method is is() is used to check whether one or more elements in a jQuery object satisfies the test condition.

Table : is() Method Argument Types

Selector Description
is(selector) It returns true if the jQuery object contains atleast one of the elements matches by the selector.
is(HTMLElement[])
is(HTMLElement)
It returns true if the jQuery object contains the specified element, or atleast one of the elements in the specified array.
filter(jQuery) To return true if the jQuery object contains at least one of the elements in the argument object.
is(jQuery) The function is called for each element, functions which return false are removed.
is(function(index)) The method returns true if the function returns true at least once.

While using the method is(), a function is specified, jQuery will invoke that function once for each element in the jQuery Object.

Unlike all other methods, is() does not create a new jQuery Object, instead it is just used to check the contents of the jQuery Object without any modification.

Example: Testing the selection using jQuery Method is()

Give it a TRY! » Note:The jQuery script selects elements with src attribute of "tintin.jpg".