Sunday, October 2, 2011

$.extend(Object,Object,Object)

$.extend(Object target, Object prop1, Object propN) returns Object
Extend one object with one or more others, returning the original, modified, object. This is a great utility for simple inheritance.

Example:

Merge settings and options, modifying settings
var settings = { validate: false, limit: 5, name: "foo" };
var options = { validate: true, name: "bar" };
jQuery.extend(settings, options);

Result:
settings == { validate: true, limit: 5, name: "bar" }

No comments:

Post a Comment