Relax Breath of Solution.Community tech blog of Sameera Thilakasiri - Consultant UI, UX, RWD Specialist/ Interactive Designer

Just I wanted.. Do you?…

jQuery Utility Functions

Posted on August 28, 2011 | Comments Off on jQuery Utility Functions

This function is used to remove all the functions from the queue that have not been executed.

The jQuery.contains() function is used to check if a DOM node is within another DOM node.
jQuery.contains( container, contained )
jQuery.contains(document.documentElement, document.body); // true
jQuery.contains(document.body, document.documentElement); // false
The function is used to add data of any type to a DOM element..
eg:- element, key, value )
Note: this method currently does not provide cross-platform support for setting data on XML documents, as Internet Explorer does not allow data to be attached via expando properties.

The .dequeue() function is used to remove the next function on the queue.

The jQuery.dequeue() is used to execute the next function on the queue for the matched element.

The jQuery.each() function is not same as .each(), which is used to iterate over the jQuery objects. The jQuery.each() iterates through the array displaying each number as both a word and numeral.
var map = {
‘flammable’: ‘inflammable’,
‘duh’: ‘no duh’
$.each(map, function(key, value) {
alert(key + ‘: ‘ + value);

flammable: inflammable
duh: no duh

The jQuery.extend() function merge the contents of two or more objects together into the first object.
jQuery.extend( [deep,] target, object1, [objectN] )
deepIf true, the merge becomes recursive (aka. deep copy).
targetThe object to extend. It will receive the new properties.
object1An object containing additional properties to merge in.
objectNAdditional objects containing properties to merge in.

Execute some JavaScript code globally.

The jQuery.grep() function is used to find the elements of an array which satisfy a filter function. The original array is not affected.

The jQuery.inArray() function searches for a specified value within an array and return its index (or -1 if not found).

The jQuery.isArray() function is used to determine whether the argument is an array.

The jQuery.isEmptyObject() function is used to check to see if an object is empty (in order words contains no properties).

The jQuery.isFunction() is used to determine if the argument passed is a Javascript function object.

The function jQuery.isPlainObject() is used to find if an object is a plain object (created using “{}” or “new Object”).

The jQuery.isXMLDoc() function is used to find if a DOM node is within an XML document (or is an XML document).

The function jQuery.makeArray() is used to convert an array-like object into a true JavaScript array.
The function translates all items in an array or array-like object to another array of items.

The function jQuery.merge() merge the contents of two arrays together into the first array.

The jQuery.noop() is an empty function.

The jQuery.parseJSON function takes a well-formed JSON string as parameter and then returns the resulting JavaScript object.

The jQuery.proxy() function Takes a function and returns a new one that will always have a particular context.

It shows the queue of functions to be executed on the matched elements.

It shows the queue of functions to be executed on the matched element.

This function is used to remove a previously-stored piece of data.
Properties of the Global jQuery Object.

It is used to remove the whitespace from the beginning and end of a string.

The jQuery.unique() function sorts an array of DOM elements, in place, with the duplicates removed.

Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.


Comments are closed.