English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery map() Method

jQuery Traversal Methods

The map() method is used to pass each element in the current matching set through a function, thus generating a new jQuery object containing the returned values.

You can use this method to build a list of values, attributes, CSS values-Even perform special, custom selector transformations.

Syntax:

$.map(selector, callback)

Example

Build a list of all values in the form:

$("p").append($("input").map(function(){
  return $(this).val();
}).get().join(", "));
Test See‹/›

Parameter Value

ParameterDescription
callbackSpecify the function object to be called for each element in the current set

jQuery Traversal Methods