new ZebraJS(selector, parentopt, first_onlyopt) → {array}
- Source:
- Version:
- 1.0.3 (last revision May 10, 2024)
- Copyright:
- (c) 2016-2024 Stefan Gabos
- License:
- LGPL-3.0
Creates a ZebraJS object which provides methods meant for simplifying the interaction with the set of
elements matched by the selector
argument. This is referred to as wrapping
those elements.
Example
// select an element by ID
var element = $('#foo');
// select element by class name
var elements = $('.foo');
// select elements by using JavaScript
var elements = $(document.querySelectorAll('.foo'));
// use CSS selectors
var elements = $(input[type=text]);
// create elements
var element = $('<div>').addClass('foo').appendTo($('body'));
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
selector |
mixed | A selector to filter DOM elements from the current document. It can be a
query selector, a ZebraJS object, a DOM element, a
NodeList,
and array of DOM elements |
|
parent |
mixed |
<optional> |
A selector to filter DOM elements from the current document, but only those which have as parent the element(s) indicated by this argument. It can be a query selector, a ZebraJS object, a DOM element, a NodeList, and array of DOM elements |
first_only |
boolean |
<optional> |
Setting this argument will instruct the method to return only the first element from the set of matched elements. |
Returns:
Returns a special array holding the matching elements and having all the methods to help you work with those elements.
- Type
- array
Methods
$.ajax(urlopt, options)
- Source:
Performs an asynchronous HTTP (Ajax) request.
Example
$.ajax({
url: 'http://mydomain.com/index.html',
method: 'GET',
data: {
foo: 'baz',
bar: 'bax'
},
error: function() {
alert('error!');
},
success: function() {
alert('success!');
}
});
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
string |
<optional> |
The URL to which the request is to be sent. |
||||||||||||||||||||||||||||||
options |
object | A set of key/value pairs that configure the Ajax request.
|
$.each(callback) → {undefined}
- Source:
Iterates over an array or an object, executing a callback function for each item.
For iterating over a set of matched elements, see the each() method.
Example
$.each([1, 2, 3, 4], function(index, value) {
console.log(index + ': ' + value);
});
var obj = {
prop1: 'value1',
prop2: 'value2'
};
$.each(obj, function(index, value) {
console.log(index + ': ' + value);
});
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | The function to execute for each item in the set. The callback function receives two
arguments: the item's position in the set, called
|
Returns:
- Type
- undefined
$.extend(target) → {object}
- Source:
Merges the properties of two or more objects together into the first object.
Example
// merge the properties of the last 2 objects into the first one
$.extend({}, {foo: 'baz'}, {bar: 'biz'});
// the result
// {foo: 'baz', bar: 'biz'}
Parameters:
Name | Type | Description |
---|---|---|
target |
object | An object whose properties will be merged with the properties of the additional objects passed as arguments to this method. |
Returns:
Returns an object with the properties of the object given as first argument merged with the properties of additional objects passed as arguments to this method.
- Type
- object
$.inArray(value, array) → {integer}
- Source:
Search for a given value within an array and returns the first index where the value is found, or -1
if the value
is not found.
This method returns -1
when it doesn't find a match. If the searched value is in the first position in the array
this method returns 0
, if in second 1
, and so on.
Because in JavaScript
0 == false
(but0 !== false
), to check for the presence of value within array, you need to check if it's not equal to (or greater than)-1
.
This method is here only for compatibility purposes and you shouldn't use it - you should use instead JavaScript's own indexOf
Example
// returns 4
$.inArray(5, [1, 2, 3, 4, 5, 6, 7]);
Parameters:
Name | Type | Description |
---|---|---|
value |
mixed | The value to search for |
array |
array | The array to search in |
Returns:
Returns the position of the searched value inside the given array (starting from 0
), or -1
if the value couldn't be found.
- Type
- integer
$.isArray(object) → {bool}
- Source:
Determines whether the object given as argument is an array.
This method is here only for compatibility purposes and you shouldn't use it - you should use instead JavaScript's own Array.isArray
Example
// returns TRUE
$.isArray([1, 2, 3, 4, 5, 6, 7]);
Parameters:
Name | Type | Description |
---|---|---|
object |
mixed | Object to test whether or not it is an array. |
Returns:
A boolean indicating whether the object is a JavaScript array (not an array-like object such as a ZebraJS object).
- Type
- bool
addClass(class_name) → {ZebraJS}
- Source:
Adds one or more classes to each element in the set of matched elements.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// add a single class
elements.addClass('foo');
// add multiple classes
elements.addClass('foo baz');
// chaining
elements.addClass('foo baz').css('display', 'none');
Parameters:
Name | Type | Description |
---|---|---|
class_name |
string | One or more space-separated class names to be added to each element in the set of matched elements. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
after(content) → {ZebraJS}
- Source:
Inserts content specified by the argument after each element in the set of matched elements.
Both this and the .insertAfter() method perform the same task, the main difference being
in the placement of the content and the target. With .after()
, the selector expression preceding the method is the
target after which the content is to be inserted. On the other hand, with .insertAfter()
, the content precedes the
method and it is the one inserted after the target element.
Clones of the inserted element will be created after each element in the set of matched elements, except for the last one. The original item will be inserted after the last element.
If the content to be inserted is an element existing on the page, clones of the element will be created after each element in the set of matched elements, except for the last one. The original item will be moved (not cloned) after the last element.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var target = $('#selector');
// insert a div that we create on the fly
target.after($('<div>').text('hello'));
// same thing as above
target.after($('<div>hello</div>'));
// inserting elements already existing on the page
target.after($('ul'));
// insert a string (which will be transformed in HTML)
target.after('<div>hello</div>');
// chaining
target.append($('div')).addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
content |
mixed | DOM element, text node, HTML string or ZebraJS object to be inserted after each element in the set of matched elements. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
animate(properties, durationopt, easingopt, callbackopt) → {ZebraJS}
- Source:
Perform a custom animation of a set of CSS properties using transitions.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// fade out
elements.animate({
opacity: 0
}, 250, function() {
console.log('Animation is complete!');
});
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
properties |
object | An object of CSS properties and values that the animation will move toward. |
|
duration |
number | string |
<optional> |
A string or a number determining how long, in milliseconds, the animation will run.
|
easing |
string |
<optional> |
The easing function to use.
swing
|
callback |
function |
<optional> |
A function to call once the animation is complete, called once per matched element. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
append(content) → {ZebraJS}
- Source:
Inserts content, specified by the argument, to the end of each element in the set of matched elements.
Both this and the .appendTo() method perform the same task, the main difference being in the
placement of the content and the target. With .append()
, the selector expression preceding the method is the
container into which the content is to be inserted. On the other hand, with .appendTo()
, the content precedes the
method, and it is inserted into the target container.
If there is more than one target element, clones of the inserted element will be created for each target except for the last one. For the last target, the original item will be inserted.
If an element selected this way is inserted elsewhere in the DOM, clones of the inserted element will be created for each target except for the last one. For the last target, the original item will be moved (not cloned).
Example
// always cache selectors
// to avoid DOM scanning over and over again
var parent = $('#selector');
// append a div that we create on the fly
parent.append($('<div>').text('hello'));
// same thing as above
parent.append($('<div>hello</div>'));
// append one or more elements that already exist on the page
// if "parent" is a single element than the list will be moved inside the parent element
// if "parent" is a collection of elements, clones of the list element will be created for
// each target except for the last one; for the last target, the original list will be moved
parent.append($('ul'));
// append a string (which will be transformed in HTML)
// this is more efficient memory wise
parent.append('<div>hello</div>');
// chaining
parent.append($('div')).addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
content |
mixed | DOM element, text node, HTML string or ZebraJS object to insert at the end of each element in the set of matched elements. |
Returns:
Returns the set of matched elements (the parents, not the appended elements).
- Type
- ZebraJS
appendTo(parent) → {ZebraJS}
- Source:
Inserts every element in the set of matched elements to the end of the parent element(s), specified by the argument.
Both this and the .append() method perform the same task, the main difference being in the
placement of the content and the target. With .append()
, the selector expression preceding the method is the
container into which the content is to be inserted. On the other hand, with .appendTo()
, the content precedes the
method, and it is inserted into the target container.
If there is more than one target element, clones of the inserted element will be created for each target except for the last one. For the last target, the original item will be inserted.
If an element selected this way is inserted elsewhere in the DOM, clones of the inserted element will be created for each target except for the last one. For the last target, the original item will be moved (not cloned).
Example
// always cache selectors
// to avoid DOM scanning over and over again
var parent = $('#selector');
// append a div that we create on the fly
$('<div>').text('hello').appendTo(parent);
// same thing as above
$('<div>hello</div>').appendTo(parent);
// append one or more elements that already exist on the page
// if "parent" is a single element than the list will be moved inside the parent element
// if "parent" is a collection of elements, clones of the list element will be created for
// each target except for the last one; for the last target, the original list will be moved
$('ul').appendTo(parent);
Parameters:
Name | Type | Description |
---|---|---|
parent |
ZebraJS | A ZebraJS object at end of which to insert each element in the set of matched elements. |
Returns:
Returns the ZebraJS object you are appending to.
- Type
- ZebraJS
attr(attribute, valueopt) → {ZebraJS|mixed}
- Source:
Gets the value of an attribute for the first element in the set of matched elements, or sets one or more attributes for every matched element.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// get the value of an attribute for the first
// element in the set of matched elements
elements.attr('id');
// set a single attribute
elements.attr('title', 'title');
// set multiple attributes
elements.attr({
title: 'title',
href: 'href'
});
// remove an attribute
elements.attr('title', false);
// chaining
elements.attr('title', 'title').removeClass('foo');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
attribute |
string | object | If given as a |
|
value |
string |
<optional> |
The value to be set for the attribute given as argument. Only used if |
Returns:
When setting
attributes, this method returns the set of matched elements.
When reading
attributes, this method returns the value of the required attribute.
- Type
- ZebraJS | mixed
before(content) → {ZebraJS}
- Source:
Inserts content, specified by the argument, before each element in the set of matched elements.
Both this and the .insertBefore() method perform the same task, the main difference
being in the placement of the content and the target. With .before()
, the selector expression preceding the method
is the target before which the content is to be inserted. On the other hand, with .insertBefore()
, the content
precedes the method, and it is the one inserted before the target element.
If there is more than one target element, clones of the inserted element will be created before each target except for the last one. The original item will be inserted before the last target.
If an element selected this way is inserted elsewhere in the DOM, clones of the inserted element will be created before each target except for the last one. The original item will be moved (not cloned) before the last target.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var target = $('#selector');
// insert a div that we create on the fly
target.before($('<div>').text('hello'));
// same thing as above
target.before($('<div>hello</div>'));
// use one or more elements that already exist on the page
// if "target" is a single element than the list will be moved before the target element
// if "parent" is a collection of elements, clones of the list element will be created before
// each target, except for the last one; the original list will be moved before the last target
target.before($('ul'));
// insert a string (which will be transformed in HTML)
// this is more efficient memory wise
target.append('<div>hello</div>');
// chaining
target.append($('div')).addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
content |
mixed | DOM element, text node, HTML string, or ZebraJS object to be inserted before each element in the set of matched elements. |
Returns:
Returns the set of matched elements (the parents, not the inserted elements).
- Type
- ZebraJS
children(selector) → {ZebraJS}
- Source:
Gets the children of each element in the set of matched elements, optionally filtered by a selector.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// get all the element's children
var children_all = element.children();
// get all the "div" children of the element
var children_filtered = element.children('div');
// chaining
element.children('div').addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | If the selector is supplied, the elements will be filtered by testing whether they match it. |
Returns:
Returns the children of each element in the set of matched elements, as a ZebraJS object.
- Type
- ZebraJS
clone(with_data_and_events, deep_with_data_and_events) → {ZebraJS}
- Source:
Creates a deep copy of the set of matched elements.
This method performs a deep copy of the set of matched elements meaning that it copies the matched elements as well as all of their descendant elements and text nodes.
Normally, any event handlers bound to the original element are not copied to the clone. Setting the with_data_and_events
argument to true
will copy the event handlers and element data bound to the original element.
This method may lead to duplicate element IDs in a document. Where possible, it is recommended to avoid cloning elements with this attribute or using class attributes as identifiers instead.
Element data will continue to be shared between the cloned and the original element. To deep copy all data, copy each one manually.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// clone element with data and events, including data and events of children
var clones = element.clone(true, true)
// chaining - clone and insert into the body element
element.clone(true, true).appendTo($('body'));
Parameters:
Name | Type | Description |
---|---|---|
with_data_and_events |
boolean | Setting this argument to |
deep_with_data_and_events |
boolean | Setting this argument to |
Returns:
Returns the cloned elements, as a ZebraJS object.
- Type
- ZebraJS
closest(selector) → {ZebraJS}
- Source:
For each element in the set, get the first element that matches the selector by traversing up through its ancestors in the DOM tree, beginning with the current element.
Given a ZebraJS object that represents a set of DOM elements, this method searches through the ancestors of these elements in the DOM tree, beginning with the current element, and constructs a new ZebraJS object from the matching elements.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// get the first parent that is a div
var closest = element.closest('div');
// chaining
element.closest('div').addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | If the selector is supplied, the parents will be filtered by testing whether they match it. |
Returns:
Returns zero or one element for each element in the original set, as a ZebraJS object
- Type
- ZebraJS
css(property, valueopt) → {ZebraJS|mixed}
- Source:
Gets the value of a computed style property for the first element in the set of matched elements, or sets one or more CSS properties for every matched element.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// get the value of a computed style property
// for the first element in the set of matched elements
elements.css('width');
// set a single CSS property
elements.css('position', 'absolute');
// set multiple CSS properties
elements.css({
position: 'absolute',
left: 0,
top: 0
});
// remove a property
elements.attr('position', false);
// chaining
elements.css('position', 'absolute').removeClass('foo');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
property |
string | object | If given as a |
|
value |
string |
<optional> |
The value to be set for the CSS property given as argument. Only used if |
Returns:
When setting
CSS properties, this method returns the set of matched elements.
When reading
CSS properties, this method returns the value(s) of the required computed style(s).
- Type
- ZebraJS | mixed
data(name, value) → {ZebraJS|mixed}
- Source:
Stores arbitrary data associated with the matched elements, or returns the value at the named data store for the first element in the set of matched elements.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// set some data
elements.data('foo', 'baz');
// retrieve previously set data
elements.data('foo');
// set an object as data
elements.data('foo', {bar: 'baz', qux: 2});
Parameters:
Name | Type | Description |
---|---|---|
name |
string | A string naming the piece of data to set. |
value |
mixed | The value to associate with the data set. |
Returns:
When setting
data attributes, this method returns the set of matched elements.
When reading
data attributes, this method returns the stored values, or undefined
if not data found for the requested key.
- Type
- ZebraJS | mixed
detach() → {ZebraJS}
- Source:
Removes the set of matched elements from the DOM.
This method is the same as the .remove() method, except that .detach() keeps all events and data associated with the removed elements. This method is useful when removed elements are to be reinserted into the DOM at a later time.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// remove elements from the DOM
var detached = element.detach();
// add them back, together with data and events,
// to the end of the body element
$('body').insert(detached);
Returns:
Returns the removed elements.
- Type
- ZebraJS
each(callback) → {undefined}
- Source:
Iterates over the set of matched elements, executing a callback function for each element in the set.
Example
$('selector').each(function(index) {
// show the element's index in the set
console.log(index);
// remember, inside the callback, the "this" keyword refers to the DOM element
$(this).css('display', 'none');
});
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | The function to execute for each item in the set. The callback function receives two
arguments: the element's position in the set, called |
Returns:
- Type
- undefined
eq(index) → {ZebraJS}
- Source:
Reduces the set of matched elements to the one at the specified index.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('.selector');
// assuming there are 6 elements in the set of matched elements
// add the "foo" class to the 5th element
elements.eq(4).addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
index |
integer | An integer indicating the 0-based position of the element. If a negative integer is given the counting will go backwards, starting from the last element in the set. |
Returns:
Returns the element at the specified index, as a ZebraJS object.
- Type
- ZebraJS
find(selector) → {ZebraJS}
- Source:
Gets the descendants of each element in the current set of matched elements, filtered by a selector, ZebraJS object, or a DOM element.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// find the element's div descendants
var target = element.find('div');
// this is equivalent with the above
var target = $('div', element);
// chaining
element.find('div').addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | A selector to filter descendant elements by. It can be a query selector, a ZebraJS object, or a DOM element. |
Returns:
Returns the descendants of each element in the current set of matched elements, filtered by a selector, ZebraJS object, or DOM element, as a ZebraJS object.
- Type
- ZebraJS
first() → {ZebraJS}
- Source:
Constructs a new ZebraJS object from the first element in the set of matched elements.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// returns the first element from the list of matched elements, as a ZebraJS object
var first = elements.first();
Returns:
Returns the first element from the list of matched elements, as a ZebraJS object
- Type
- ZebraJS
get(index)
- Source:
Retrieves one of the elements matched by the ZebraJS object.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// this gets the second DOM element from the list of matched elements
elements.get(1);
Parameters:
Name | Type | Description |
---|---|---|
index |
integer | The index (starting from |
hasClass(class_name) → {boolean}
- Source:
Checks whether any of the matched elements have the given class.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// check if matched elements have a certain class
var class_exists = elements.hasClass('foo');
// chaining
elements.toggleClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
class_name |
string | The name of a class to be checked if it exists on any of the elements in the set of matched elements. |
Returns:
Returns TRUE if the sought class exists in any of the elements in the set of matched elements.
- Type
- boolean
height(heightopt) → {ZebraJS|float}
- Source:
Returns the current computed inner height (without padding
, border
and margin
) of the first element
in the set of matched elements as float
, or sets the height
CSS property of every element in the set.
See .outerHeight() for getting the height including padding
, border
and, optionally,
margin
.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// returns the current computed inner height of the first element in the set of matched elements
elements.height();
// sets the "height" CSS property of all elements in the set to 200px
elements.height(200);
elements.height('200');
elements.height('200px');
// sets the "height" CSS property of all elements in the set to 5em
elements.height('5em');
// chaining
elements.height(200).addClass('foo');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
height |
undefined | number | string |
<optional> |
If not given, the method will return the computed inner
height (without
|
Returns:
When setting the height
, this method returns the set of matched elements.
Otherwise, it returns the current computed inner height (without padding
, border
and margin
) of the first element in the set of matched elements, as float
.
- Type
- ZebraJS | float
hide() → {ZebraJS}
- Source:
Hides an element from the DOM by settings its "display" property to none
.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('selector');
// hide the element from the DOM
element.hide();
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
html(contentopt) → {ZebraJS|string}
- Source:
Gets the HTML content of the first element in the set of matched elements, or set the HTML content of every matched element.
There are some security considerations that you should be aware of when using this method.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// set the HTML content for all the matched elements
elements.html('<p>Hello</p>');
// get the HTML content of the first
// element in the set of matched elements
var content = elements.html();
// chaining
elements.html('<p>Hello</p>').addClass('foo');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
content |
string |
<optional> |
The HTML content to set as the content of all the matched elements. Note that any content that was previously in that element is completely replaced by the new content. |
Returns:
When the content
argument is provided, this method returns the set of matched
elements. Otherwise it returns the HTML content of the first element in the set of
matched elements.
- Type
- ZebraJS | string
insertAfter(target) → {ZebraJS}
- Source:
Inserts every element in the set of matched elements after the parent element(s), specified by the argument.
Both this and the .after() method perform the same task, the main difference being in the
placement of the content and the target. With .after()
, the selector expression preceding the method is the target
after which the content is to be inserted. On the other hand, with .insertAfter()
, the content precedes the method,
and it is the one inserted after the target element(s).
If there is more than one target element, clones of the inserted element will be created after each target except for the last one. The original item will be inserted after the last target.
If an element selected this way is inserted elsewhere in the DOM, clones of the inserted element will be created after each target except for the last one. The original item will be moved (not cloned) after the last target.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var target = $('#selector');
// insert a div that we create on the fly
$('<div>').text('hello').insertAfter(target);
// same thing as above
$('<div>hello</div>').insertAfter(target);
// use one or more elements that already exist on the page
// if "target" is a single element than the list will be moved after the target element
// if "parent" is a collection of elements, clones of the list element will be created after
// each target, except for the last one; the original list will be moved after the last target
$('ul').insertAfter(target);
Parameters:
Name | Type | Description |
---|---|---|
target |
ZebraJS | A ZebraJS object after which to insert each element in the set of matched elements. |
Returns:
Returns the ZebraJS object after the content is inserted.
- Type
- ZebraJS
insertBefore(target) → {ZebraJS}
- Source:
Inserts every element in the set of matched elements before the parent element(s), specified by the argument.
Both this and the .before() method perform the same task, the main difference being in the
placement of the content and the target. With .before()
, the selector expression preceding the method is the target
before which the content is to be inserted. On the other hand, with .insertBefore()
, the content precedes the method,
and it is the one inserted before the target element(s).
If there is more than one target element, clones of the inserted element will be created before each target except for the last one. The original item will be inserted before the last target.
If an element selected this way is inserted elsewhere in the DOM, clones of the inserted element will be created before each target except for the last one. The original item will be moved (not cloned) before the last target.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var target = $('#selector');
// insert a div that we create on the fly
$('<div>').text('hello').insertBefore(target);
// same thing as above
$('<div>hello</div>').insertBefore(target);
// use one or more elements that already exist on the page
// if "target" is a single element than the list will be moved before the target element
// if "parent" is a collection of elements, clones of the list element will be created before
// each target, except for the last one; the original list will be moved before the last target
$('ul').insertBefore(target);
Parameters:
Name | Type | Description |
---|---|---|
target |
ZebraJS | A ZebraJS object before which to insert each element in the set of matched elements. |
Returns:
Returns the ZebraJS object before which the content is inserted.
- Type
- ZebraJS
is(selector) → {boolean}
- Source:
Checks the current matched set of elements against a selector, element or ZebraJS object and returns true
if at
least one of these elements matches the given arguments.
Note that, unlike jQuery, when matching selectors, this method matches only valid CSS selectors!
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// returns true if the element is a "select" element
console.log(element.is('select'))
Parameters:
Name | Type | Description |
---|---|---|
selector |
mixed | A string containing a selector expression to match elements against, a DOM element or a ZebraJS object. |
Returns:
Returns true
if at least one of the elements from the currently matched set matches the given
argument.
- Type
- boolean
next(selector) → {ZebraJS}
- Source:
Gets the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the following sibling only if it matches that selector.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// get the next sibling
var next = element.next();
// get the following sibling only if it matches the selector
var next = element.next('div');
// chaining
element.next().addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | If the selector is provided, the method will retrieve the following sibling only if it matches the selector |
Returns:
Returns the immediately following sibling of each element in the set of matched elements, optionally filtered by a selector, as a ZebraJS object.
- Type
- ZebraJS
not(selector)
- Source:
Removes elements from the set of matched elements.
Example
// find all elements having class ".foo" but not ".bar"
$('.foo').not('.bar');
Parameters:
Name | Type | Description |
---|---|---|
selector |
mixed | Can be a string containing a selector expression, a DOM element, an array
of elements to match against the set, or a function used as a test for each
element in the set.
|
off(event_type, callback) → {ZebraJS}
- Source:
Remove an event handler.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// create a function
var callback = function(e) {
console.log('clicked!');
}
// handle clicks on element using the function created above
element.on('click', callback);
// remove that particular click event
element.off('click', callback);
// remove *all* the click events
element.off('click');
// remove *only* the click events that were namespaced
element.off('click.namespace');
Parameters:
Name | Type | Description |
---|---|---|
event_type |
string | One or more space-separated event types and optional namespaces, such as "click" or "click.namespace". |
callback |
function | A function to execute when the event is triggered. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
offset() → {object}
- Source:
Gets the current coordinates of the first element in the set of matched elements, relative to the document.
This method retrieves the current position of an element relative to the document, in contrast with the .position() method which retrieves the current position relative to the offset parent.
This method cannot get the position of hidden elements or accounting for borders, margins, or padding set on the body element.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// get the element's position, relative to the offset parent
var offset = element.offset()
Returns:
Returns an object with the left
and top
properties.
- Type
- object
on(event_type, selectoropt, callback) → {ZebraJS}
- Source:
Attaches an event handler function for one or more events to the selected elements.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// create a function
var callback = function(e) {
console.log('clicked!');
}
// handle clicks on element using the function created above
element.on('click', callback);
// handle clicks on element using an anonymous function
element.on('click', function(e) {
console.log('clicked!');
});
// namespacing, so that you can remove only certain events
element.on('click.namespace', function(e) {
console.log('clicked!');
});
// using delegation
// handle clicks on all the "div" elements
// that are children of the element
element.on('click', 'div', function(e) {
console.log('clicked!');
});
// chaining
element.on('click', function() {
console.log('clicked!');
}).addClass('foo');
// multiple events
element.on({
mouseenter: function() { ... },
mouseleave: function() { ... }
});
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
event_type |
string | One or more space-separated event types and optional namespaces, such as "click" or "click.namespace". Can also be given as an object. |
|
selector |
string |
<optional> |
A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. |
callback |
function | A function to execute when the event is triggered. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
one(event_type, selectoropt, callback) → {ZebraJS}
- Source:
Attaches an event handler function for one or more events to the selected elements. The event handler is executed at most once per element per event type.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// create a function
var callback = function(e) {
console.log('clicked!');
}
// handle clicks on element using the function created above
// (the callback will be executed only once)
element.one('click', callback);
// handle clicks on element using an anonymous function
// (the callback will be executed only once)
element.one('click', function(e) {
console.log('clicked!');
});
// namespacing, so that you can remove only certain events
// (the callback will be executed only once)
element.one('click.namespace', function(e) {
console.log('clicked!');
});
// using delegation
// handle clicks on all the "div" elements
// that are children of the element
// (the callback will be executed only once for each matched element)
element.one('click', 'div', function(e) {
console.log('clicked!');
});
// chaining
element.one('click', function() {
console.log('clicked!');
}).addClass('foo');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
event_type |
string | One or more space-separated event types and optional namespaces, such as "click" or "click.namespace". |
|
selector |
string |
<optional> |
A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. |
callback |
function | A function to execute when the event is triggered. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
outerHeight(include_marginsopt) → {float}
- Source:
Returns the current computed height for the first element in the set of matched elements, including padding
,
border
and, optionally, margin
.
For hidden elements the returned value is
0
!
See .height() for getting the inner height without padding
, border
and margin
.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('selector');
// get the element's outer height
var height = element.outerHeight();
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
include_margins |
boolean |
<optional> |
If set to |
Returns:
- Type
- float
outerWidth(include_marginsopt) → {float}
- Source:
Returns the current computed width for the first element in the set of matched elements, including padding
,
border
and, optionally, margin
.
For hidden elements the returned value is
0
!
See .width() for getting the inner width without padding
, border
and margin
.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('selector');
// get the element's outer width
var height = element.outerWidth();
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
include_margins |
boolean |
<optional> |
If set to |
Returns:
- Type
- float
parent(selector) → {ZebraJS}
- Source:
Gets the immediate parent of each element in the current set of matched elements, optionally filtered by a selector.
This method is similar to .parents(), except .parent() only travels a single level up the DOM tree.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// get the element's parent
var parent = element.parent();
// get the element's parent *only* if it is a div
var parent = element.parent('div');
// chaining
element.parent().addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | If the selector is supplied, the elements will be filtered by testing whether they match it. |
Returns:
Returns the immediate parent of each element in the current set of matched elements, optionally filtered by a selector, as a ZebraJS object.
- Type
- ZebraJS
parents(selector) → {ZebraJS}
- Source:
Gets the ancestors of each element in the current set of matched elements, optionally filtered by a selector.
Given a ZebraJS object that represents a set of DOM elements, this method allows us to search through the ancestors of these elements in the DOM tree and construct a new ZebraJS object from the matching elements ordered from immediate parent on up; the elements are returned in order from the closest parent to the outer ones. When multiple DOM elements are in the original set, the resulting set will have duplicates removed.
This method is similar to .parent(), except .parent() only travels a single level up the DOM tree, while this method travels all the way up to the DOM root.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// get *all* the element's parent
var parents = element.parents();
// get all the element's parent until the first div (including also that first div)
var parents = element.parents('div');
// chaining
element.parents('div').addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | If the selector is supplied, the parents will be filtered by testing whether they match it. |
Returns:
Returns an array of parents of each element in the current set of matched elements, optionally filtered by a selector, as a ZebraJS object.
- Type
- ZebraJS
position() → {object}
- Source:
Gets the current coordinates of the first element in the set of matched elements, relative to the offset parent.
This method retrieves the current position of an element relative to the offset parent, in contrast with the .offset() method which retrieves the current position relative to the document.
This method cannot get the position of hidden elements or accounting for borders, margins, or padding set on the body element.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// get the element's position, relative to the offset parent
var position = element.position()
Returns:
Returns an object with the left
and top
properties.
- Type
- object
prepend(content) → {ZebraJS}
- Source:
Inserts content, specified by the argument, to the beginning of each element in the set of matched elements.
Both this and the .prependTo() method perform the same task, the main difference being in
the placement of the content and the target. With .prepend()
, the selector expression preceding the method is the
container into which the content is to be inserted. On the other hand, with .prependTo()
, the content precedes the
method, and it is inserted into the target container.
If there is more than one target element, clones of the inserted element will be created for each target except for the last one. For the last target, the original item will be inserted.
If an element selected this way is inserted elsewhere in the DOM, clones of the inserted element will be created for each target except for the last one. For the last target, the original item will be moved (not cloned).
Example
// always cache selectors
// to avoid DOM scanning over and over again
var parent = $('#selector');
// append a div that we create on the fly
parent.prepend($('<div>').text('hello'));
// same thing as above
parent.prepend($('<div>hello</div>'));
// prepend one or more elements that already exist on the page
// if "parent" is a single element than the list will be moved inside the parent element
// if "parent" is a collection of elements, clones of the list element will be created for
// each target except for the last one; for the last target, the original list will be moved
parent.prepend($('ul'));
// prepend a string (which will be transformed in HTML)
// this is more efficient memory wise
parent.prepend('<div>hello</div>');
// chaining
parent.prepend($('div')).addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
content |
mixed | DOM element, text node, HTML string, or ZebraJS object to insert at the beginning of each element in the set of matched elements. |
Returns:
Returns the set of matched elements (the parents, not the prepended elements).
- Type
- ZebraJS
prependTo(parent) → {ZebraJS}
- Source:
Inserts every element in the set of matched elements to the beginning of the parent element(s), specified by the argument.
Both this and the .prepend() method perform the same task, the main difference being in the
placement of the content and the target. With .prepend()
, the selector expression preceding the method is the
container into which the content is to be inserted. On the other hand, with .prependTo()
, the content precedes the
method, and it is inserted into the target container.
If there is more than one target element, clones of the inserted element will be created for each target except for the last one. For the last target, the original item will be inserted.
If an element selected this way is inserted elsewhere in the DOM, clones of the inserted element will be created for each target except for the last one. For the last target, the original item will be moved (not cloned).
Example
// always cache selectors
// to avoid DOM scanning over and over again
var parent = $('#selector');
// prepend a div that we create on the fly
$('<div>').text('hello').prependTo(parent);
// same thing as above
$('<div>hello</div>').prependTo(parent);
// prepend one or more elements that already exist on the page
// if "parent" is a single element than the list will be moved inside the parent element
// if "parent" is a collection of elements, clones of the list element will be created for
// each target except for the last one; for the last target, the original list will be moved
$('ul').appendTo(parent);
Parameters:
Name | Type | Description |
---|---|---|
parent |
ZebraJS | A ZebraJS object at beginning of which to insert each element in the set of matched elements. |
Returns:
Returns the ZebraJS object you are appending to.
- Type
- ZebraJS
prev(selector) → {ZebraJS}
- Source:
Gets the immediately preceding sibling of each element in the set of matched elements. If a selector is provided, it retrieves the previous sibling only if it matches that selector.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// get the previous sibling
var prev = element.prev();
// get the previous sibling only if it matches the selector
var prev = element.prev('div');
// since this method returns a ZebraJS object
element.prev().addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | If the selector is provided, the method will retrieve the previous sibling only if it matches the selector |
Returns:
Returns the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector, as a ZebraJS object.
- Type
- ZebraJS
ready(callback) → {ZebraJS}
- Source:
Specifies a function to execute when the DOM is fully loaded.
Example
$(document).ready(function() {
// code to be executed when the DOM is ready
});
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | A function to execute when the DOM is ready and safe to manipulate. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
remove() → {ZebraJS}
- Source:
Removes the set of matched elements from the DOM.
Use this method when you want to remove the element itself, as well as everything inside it. In addition to the elements themselves, all attached event handlers and data attributes associated with the elements are also removed.
To remove the elements without removing data and event handlers, use .detach() instead.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// remove the element, its children, and all attached event
// handlers and data attributes associated with the elements
element.remove();
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
removeClass(class_name) → {ZebraJS}
- Source:
Removes one or more classes from each element in the set of matched elements.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// remove a single class
elements.removeClass('foo');
// remove multiple classes
elements.removeClass('foo baz');
// since this method returns the set of matched elements
elements.removeClass('foo baz').css('display', 'none');
Parameters:
Name | Type | Description |
---|---|---|
class_name |
string | One or more space-separated class names to be removed from each element in the set of matched elements. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
replaceWith(element) → {ZebraJS}
- Source:
Replaces each element in the set of matched elements with the provided new content and returns the set of elements that was removed.
Note that if the method's argument is a selector, then clones of the element described by the selector will be created and used for replacing each element in the set of matched elements, except for the last one. The original item will be moved (not cloned) and used to replace the last target.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// wrap element in a div
element.replaceWith('<div id="replacement"></div>');
// *exactly* the same thing as above
element.replaceWith($('<div id="replacement"></div>'));
// using an existing element as the wrapper
element.replaceWith($('#element-from-the-page'));
Parameters:
Name | Type | Description |
---|---|---|
element |
mixed | A string, a ZebraJS object or a DOM element to use as replacement for each element in the set of matched elements. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
scrollLeft(valueopt) → {ZebraJS|integer}
- Source:
Gets the horizontal position of the scrollbar for the first element in the set of matched elements, or sets the horizontal position of the scrollbar for every matched element.
The horizontal scroll position is the same as the number of pixels that are hidden from view above the scrollable area.
If the scroll bar is at the very left, or if the element is not scrollable, this number will be 0
.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var body = $('body');
// get the horizontal scroll of the body
body.scrollLeft();
// set the horizontal scroll of the body
body.scrollLeft(250);
// chaining
elements.scrollLeft(250).addClass('foo');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
integer |
<optional> |
Sets the horizontal position of the scrollbar for every matched element. |
Returns:
When setting
the horizontal position, this method returns the set of matched elements.
When reading
the horizontal position, this method returns the horizontal position of
the scrollbar for the first element in the set of matched elements.
- Type
- ZebraJS | integer
scrollTop(valueopt) → {ZebraJS|integer}
- Source:
Gets the vertical position of the scrollbar for the first element in the set of matched elements, or sets the vertical position of the scrollbar for every matched element.
The vertical scroll position is the same as the number of pixels that are hidden from view above the scrollable area.
If the scroll bar is at the very top, or if the element is not scrollable, this number will be 0
.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var body = $('body');
// get the vertical scroll of the body
body.scrollTop();
// set the vertical scroll of the body
body.scrollTop(250);
// chaining
elements.scrollTop(250).addClass('foo');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
integer |
<optional> |
Sets the vertical position of the scrollbar for every matched element. |
Returns:
When setting
the vertical position, this method returns the set of matched elements.
When reading
the vertical position, this method returns the vertical position of
the scrollbar for the first element in the set of matched elements.
- Type
- ZebraJS | integer
serialize() → {string}
- Source:
If the first element in the set of matched elements is a form
element, this method returns the encodes string of
the form's elements and their respective values.
Only "successful controls" are serialized to the string. No submit button value is serialized since the form was not submitted using a button. For a form element's value to be included in the serialized string, the element must have a name attribute. Values from checkboxes and radio buttons (inputs of type "radio" or "checkbox") are included only if they are checked. Data from file select elements is not serialized.
This method creates a text string in standard URL-encoded notation.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var form = $('#form');
// serialize form's elements and their values
var serialized = form.serialize();
Returns:
Returns the serialized form as a query string that could be sent to a server in an Ajax request.
- Type
- string
show() → {ZebraJS}
- Source:
Sets an element's "display" property to `` (an empty string).
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('selector');
// make element visible in the DOM
element.show();
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
siblings(selector) → {ZebraJS}
- Source:
Gets the siblings of each element in the set of matched elements, optionally filtered by a selector.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// get all the siblings of the element
var siblings_all = element.siblings();
// get all the "div" siblings of the element
var siblings_filtered = element.siblings('div');
// since this method returns a ZebraJS object
element.siblings('div').addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | If the selector is supplied, the elements will be filtered by testing whether they match it. |
Returns:
Returns the siblings of each element in the set of matched elements, as a ZebraJS object
- Type
- ZebraJS
text(contentopt) → {ZebraJS|string}
- Source:
Gets the text content of the first element in the set of matched elements (combined with the text content of all its descendants), or sets the text contents of the matched elements.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// set the text content for all the matched elements
elements.text('Hello');
// get the text content of the first element in the
// set of matched elements (including its descendants)
var content = elements.text();
// chaining
elements.text('Hello').addClass('foo');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
content |
string |
<optional> |
The text to set as the content of all the matched elements. Note that any text content that was previously in that element is completely replaced by the new content. |
Returns:
When the content
argument is provided, this method returns the set of matched
elements. Otherwise it returns the text content of the first element in the set of
matched elements (combined with the text content of all its descendants)
- Type
- ZebraJS | string
toggleClass(class_name) → {ZebraJS}
- Source:
Adds or removes one or more classes from each element in the set of matched elements, depending on the presence of each class name given as argument.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// set a random class
elements.addClass('foo');
// toggle classes
// the result will be that "foo" will be removed from the matched elements while the "baz" will be added
elements.toggleClass('foo baz');
// chaining
elements.toggleClass('foo').css('display', 'none');
Parameters:
Name | Type | Description |
---|---|---|
class_name |
string | One or more space-separated class names to be toggled for each element in the set of matched elements. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
trigger(event_type, data) → {ZebraJS}
- Source:
Execute all handlers attached to the matched elements for the given event type, in the same order they would be if the event were triggered naturally by the user.
.trigger()
ed events bubble up the DOM tree; an event handler can stop the bubbling by returning false
from the
handler or calling the .stopPropagation()
method on the event object passed into the event.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// handle clicks on element
element.on('click', function(e) {
// will return "undefined" when element is clicked
// but will return "baz" when triggered manually
console.log(e.foo)
});
// manually trigger the click event
element.trigger('click', {foo: 'baz'});
// chaining
element.trigger('click', {foo: 'baz'}).addClass('foo');
Parameters:
Name | Type | Description |
---|---|---|
event_type |
string | A string containing a JavaScript event type, such as |
data |
object | Additional parameters to pass along to the event handler. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
unwrap(selector) → {ZebraJS}
- Source:
Removes the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
This method is effectively the inverse of the .wrap() method. The matched elements (and their siblings, if any) replace their parents within the DOM structure.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// unwrap the element, whatever its parent may be
element.unwrap();
// unwrap only if the element's parent is a div
element.unwrap('div');
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | If the selector is supplied, the parent elements will be filtered and the unwrapping will occur only they match it. |
Returns:
Returns the set of matched elements.
- Type
- ZebraJS
val(valueopt) → {ZebraJS|mixed}
- Source:
Gets the current value of the first element in the set of matched elements or set the value of every matched element.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('selector');
// get the value of the first element in the list of matched elements
// (if "element" was a select box with multiple selections allowed,
// the returned value would be an array)
var value = element.val();
// set the element's value
element.val('foo');
// setting multiple values for multi-selects and checkboxes
element.val(['option1', 'option2']);
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
mixed |
<optional> |
A string, a number, or an array of strings corresponding to the value of each matched element to set as selected/checked. |
Returns:
If setting a value, this method returns the set of matched elements. If called without the argument, the method return the current value of the first element in the set of matched elements.
- Type
- ZebraJS | mixed
width(widthopt) → {ZebraJS|float}
- Source:
Returns the current computed inner width (without padding
, border
and margin
) of the first element
in the set of matched elements as float
, or sets the width
CSS property of every element in the set.
See .outerWidth() for getting the width including padding
, border
and, optionally,
margin
.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var elements = $('selector');
// returns the current computed inner width of the first element in the set of matched elements
elements.width();
// sets the "width" CSS property of all elements in the set to 200px
elements.width(200);
elements.width('200');
elements.width('200px');
// sets the "width" CSS property of all elements in the set to 5em
elements.width('5em');
// chaining
elements.width(200).addClass('foo');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
width |
undefined | number | string |
<optional> |
If not given, this method will return the computed inner
width (without
|
Returns:
When setting the width
, this method returns the set of matched elements. Otherwise,
it returns the current computed inner width (without padding
, border
and margin
)
of the first element in the set of matched elements, as float
.
- Type
- ZebraJS | float
wrap(element) → {ZebraJS}
- Source:
Wraps an HTML structure around each element in the set of matched elements.
Note that if the method's argument is a selector then clones of the element described by the selector will be created and wrapped around each element in the set of matched elements except for the last one. The original item will be moved (not cloned) and wrapped around the last target.
Example
// always cache selectors
// to avoid DOM scanning over and over again
var element = $('#selector');
// wrap element in a div
element.wrap('<div id="container"></div>');
// *exactly* the same thing as above
element.wrap($('<div id="container"></div>'));
// using an existing element as the wrapper
element.wrap($('#element-from-the-page'));
Parameters:
Name | Type | Description |
---|---|---|
element |
mixed | A string, a ZebraJS object or a DOM element in which to wrap around each element in the set of matched elements. |
Returns:
Returns the original set of matched elements.
- Type
- ZebraJS