jquery-1.2.6 extend and interoperability example

html

<div id="content" style="display:none">    div#content style="display:none"    <span>div > span</span>    <p>div > p</p></div><input type="checkbox" name="c1[]" value="1" id="c1">checkbox#c1<input type="checkbox" name="c1[]" value="1" id="c2">checkbox#c2<input type="checkbox" name="c1[]" value="1" id="c3">checkbox#c3<input type="radio" name="r1" value="1" id="r1">raido#r1<input type="radio" name="r1" value="1" id="r2" checked>raido#r2<input type="radio" name="r3" value="1" id="r3">raido#r3<input type="radio" name="r3" value="1" id="r4" checked>raido#r4<script type="text/javascript" charset="utf-8" src="/lib/prototype.js"></script><script type="text/javascript" charset="utf-8" src="/lib/jquery/jquery-1.2.6.js"></script>

javascript

// Extends the jQuery Object itself.// jQuery.extend( Object object ) returns jQueryjQuery.extend({    min: function(a, b) {        return a < b ? a : b;    },    max: function(a, b) {        return a > b ? a : b;    }});// Result:var min = jQuery.min(2, 3); // => 2var max = jQuery.max(4, 5); // => 5console.log(min);console.log(max);// jQuery.extend( Object target, Object object1, Object objectN ) returns Object// Extend one object with one or more others, returning the original, modified, object.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"}console.log(settings);// jQuery.fn.extend( Object object ) returns jQuery// Extends the jQuery element set to provide new methods (used to make a typical jQuery plugin).jQuery.fn.extend({    check: function() {        return this.each(function() {            this.checked = true;        });    },    uncheck: function() {        return this.each(function() {            this.checked = false;        });    }});// Result:jQuery("input[@type=checkbox]").check();jQuery("input[@type=radio]").not("#r1").uncheck();// Maps the original object that was referenced by $ back to $.jQuery.noConflict();// Do something with jQueryjQuery("div > p").hide();// Do something with another library's $()$("content").style.display = 'block';// Completely move jQuery to a new namespace in another object.var dom = {};dom.query = jQuery.noConflict(true);// Do something with the new jQuerydom.query("div > span").hide();