Jquery_test _ $. FN. XX and $. FN. Extend. XX and $. Extend. xx

Source: Internet
Author: User

<HTML>
<Head>
<Title> jquery_extend_test [simple inheritance] </title>
<SCRIPT src = "jquery-1.6.js"> </SCRIPT>
<SCRIPT src = "jquery_extend_test.js"> </SCRIPT>
<Style>
* {Margin: 0; padding: 0 ;}
H5 {
Background-color: Gray;
}
SPAN {
Background-color: yellow;
}
Pre {
Margin-top: 10px;
Color: # FFF;
Background-color: #000;
}
</Style>
</Head>
<Body>
<H5> 1. $ in jquery is equivalent to jquery [as a jquery class] </H5>
<H5> 2. jquery (function () {call fun1; call fun2 ;...}); <======> jquery (document ). ready (function () {call fun1; call fun2 ;..}); </H5>
<HR/>
<H5> $. FN. Extend ({funname: function () {}}); </H5>
<Input type = "button" id = "test1" value = "test1" onclick = "$ (this). showme ('prefix');"/>
<Span> instance method [$ (this). showme (prefix)] </span> <br/>

<H5> $. FN. funname = function () {}; ----- $. fn = jquery. fn = jquery. prototype [prototype is the prototype mode, which is implemented by copying objects-different from class/static methods] </H5>
<Input type = "button" id = "Test2" value = "Test2" onclick = "$ (this). showme1 ('prefix');"/>
<Span> instance method [$ (this). showme1 (prefix)] </span> <br/>

<H5> $. Extend ({funname: function () {}}); </H5>
<Input type = "button" id = "test3" value = "test3" onclick = "$. showappointedone ($ ('# test3');"/>
<Span> class/static method [$. showappointedone ($ ('# test3')] </span> <br/>

<PRE onclick = "(function (arg1) {alert (arg1) ;}) ('argteststr');">
Original JavaScript-Anonymous Function Definition + execution [click]
(Function (arg1 ){
Alert (arg1 );
}) ('Argteststr ');
</PRE>

<PRE onclick = "(function ($) {alert ($ ('# test1'). Val () ;}) (jquery);">
Jquery anonymous Function Definition + execution [click]
(Function ($ ){
Alert ($ ('# test1'). Val ());
}) (Jquery );
</PRE>
</Body>
<SCRIPT>
</SCRIPT>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.