1. Use jquery

Source: Internet
Author: User

Recommended learning resources from: Zhang Ziqiu http://www.cnblogs.com/zhangziqiu/tag/jQuery%e6%95%99%e7%a8%8b/

Fu Lao Zhang's selfless dedication: API Manual

Training code during learning

Summary:

What is jquery? How to Use jquery in vs2010? The last example is jquery.

Content:

Jquery is a Javascript script library similar to the. NET class library. We encapsulate some methods for ease of use.

Therefore, using jquery can improve the efficiency of JavaScript writing. Among these similar JS scripts, jquery is widely used. The benefits of taking the time to learn and use are:

1. Powerful functions

2. Solve the browser compatibility (this is enough to make you look good)

3. Implement rich UI

4. seamless integration with. net

5. more robust, simpler, and richer

 

Using jquery in vs2010 is very convenient, not like installing something in vs2008. In vs2010, as long as a new web program is created, the jquery class library will be automatically introduced into scripts:

1, jquery- 1.3.2 -Vsdoc. JS: contains the jquery class library and vs smart sensing library, prompting you to enter

2, jquery- 1.3.2 . JS: contains the jquery class library

3, jquery- 1.3.2 . Min. JS: contains the compressed jquery class library, which is officially used in the environment

 

You also need to reference:

   <scripttype="text/javascript"src="scripts/jquery-
 
  1.3.2
 -vsdoc2.js">

Then you can use this library and smart sensing.

 

The recommended method is:

    <script type="text/javascript" src="scripts/jquery-
 
  1.2.6
 .min.js"></script>
    <%if (false)
      { %>
    <script type="text/javascript" src="scripts/jquery-
 
  1.3.2
 -vsdoc2.js"></script>    
    <%} %>

This method is intelligently perceived during compilation, and only Min. JS is compiled during compilation.

The reference method in. JS is:

        /// <reference path="jquery-
 
  1.3.2
 -vsdoc2.js" />

 

 

Hello world example:

<Div id = "Div">

Hello world!

</Div>

<Input id = "btnshow" type = "button" value = "display"/>

<Input id = "btnhide" type = "button" value = "hide"/>

<Input id = "btnchange" type = "button" value = "change to hello World jquery! "/>

<Scripttype = "text/JavaScript">

$ ("# Btnshow"). BIND ("click", function (event) {$ ("# Div"). Show ();});

$ ("# Btnhide"). BIND ("click", function (event) {$ ("# Div"). Hide ();});

$ ("# Btnchange"). BIND ("click", function (event) {$ ("# Div" ).html ("Hello World jquery! ");});

</SCRIPT>

 

Knowledge Used in this example:

1. jquery ID selector: $ ("# btnshow ")

2. bind an event: BIND ()

3. Hidden and displayed functions: Show () and hide ()

4. Modify the internal HTML function of the element: 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.