Getting started with JQuery-detailed introduction to the Code style of the JQuery program _ jquery-js tutorial

Source: Internet
Author: User
Tags jquery library
A good code style can effectively increase readability. This section describes the code style of the jQuery program. If you are interested, refer to Chapter 1st of the jQuery authoritative guide to get started with jQuery development, this chapter introduces the download of the jQuery library and introduces simple application methods based on the basic concepts of jQuery; the latter part focuses on jQuery's introduction to DOM object control and page CSS styles. through some simple small examples, readers can have a general understanding of jQuery's functional applications on pages, this lays the foundation for the next chapter to learn more about the detailed objects and methods of the jQuery library. This section describes the code style of the jQuery program.

1.1.5 code style of the jQuery Program
1. Use of the $ Operator
In the jQuery program, the most commonly used is the $ symbol. This symbol must be used for selection of page elements and prefix of function functions, it can be said that it is a sign of the jQuery program.
2. Event operation link writing
When writing an element event on a page, the jQuery program can write all the events of the element in a link-based manner. In order to better illustrate the use of this writing method, we will elaborate through an example.
Example 1-2 jQuery event chain writing
(1) Function Description
On the page, there is

Tag, which contains two

Tag. One is the topic and the other is the content. The content contained when the page is loaded for the first time.

The tag is invisible. When the user clicks the topic

Changes the background color and

Marked.
(2) Implementation Code
Create an HTML file 1-2.html and add the code shown in code 1-2.
Code List 1-2 chained Writing of jQuery events

The Code is as follows:


Transitional // EN"
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>


JQuery event chain writing

Related Article

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.