Custom Event: trigger (type, [data]): type (String, Event, Object): An Event Object or Event type to be triggered; data (Array): (optional) additional parameters passed to the event handler; [javascript] $ (& quot; p & quot ;). click (function (e...
Custom events:
Trigger (type, [data]):
Type (String, Event, Object): An Event Object or Event type to be triggered;
Data (Array): (optional) additional parameters passed to the event processing function;
[Javascript] $ ("p"). click (function (event, a, B ){
// For a common Click Event, the and B types are undefined.
// If triggered with the following statement, a points to "foo", and B points to "bar"
}). Trigger ("click", ["foo", "bar"]);
[Javascript] $ ("ul"). bind ("myclick", function (event, prarm ){
Alert (prarm. data [0]);
});
$ ("Input [type = button]"). bind ("click", {"uname": "zhangsan", "age": 50}, function (){
If (arguments [0]. data. age> = 50 ){
$ ("Ul"). trigger ("myclick", {"data": ["name", "zhangsan"]});
}
});
Extension:
JQuery. extend ([deep], target, obj1, [objN]):
Deep (optional) (Object): recursive merge if set to true.
Target (Object): the Object to be modified.
Object1 (Object): the Object to be merged into the first Object.
ObjectN (Object): (optional) Object to be merged to the first Object.
Merge settings and options, modify and return settings:
[Javascript] var settings = {validate: false, limit: 5, name: "foo "};
Var options = {validate: true, name: "bar "};
Var news = jQuery. extend (settings, options );
Alert (settings. validate );
Merge settings and options, and return settings without modification:
[Javascript] var settings = {validate: false, limit: 5, name: "foo "};
Var options = {validate: true, name: "bar "};
Var news = jQuery. extend ({}, settings, options );
Alert (settings. validate );
From example