Basic jquery tutorial (jQuery Fundamentals) -- (Part 1) Overview

Source: Internet
Author: User
Document directory
  • Get jquery code
  • Necessary software for development
  • Add javaScript to your page
  • Javascript debugging
  • Exercise
  • Some conventions in this book
  • References

  Jquery was used in a previous project. A friend recommended jquery fundamentals to study it at that time. I felt pretty good. I translated some fragments intermittently for reference by colleagues in the project team. Google does not find the Chinese translation of this tutorial.

Recently I sorted out my computer and saw it again. There are a lot of flaws in the translation fragments. I have slowly sorted them out and prepared to release them to the garden. I hope the key to learning jquery is to help students who feel hard at English. Due to limited personal abilities and energy, mistakes are inevitable. Thank you for your correction.

It will be sorted out later.


Basic Jquery tutorial

Author: Rebecca Murphey

Original link address http://jqfundamentals.com/

With contributions by James Padolsey, Paul Irish, and others. See the GitHub repository for a complete history of contributions.

Copyright 2011

 

Basic jquery tutorial (jQuery Fundamentals) -- (Part 1) Overview

Jquery Fundamentals-(Part 2) javascript Basics

Basic jquery tutorial (jQuery Fundamentals) -- (part 3) Basic jquery

Jquery Fundamentals-(part 4) jQuery Core

Jquery Fundamentals-(Part 5) jQuery events

Basic jquery tutorial (jQuery Fundamentals) -- (Part 6) jquery Effect

Basic jquery tutorial (jQuery Fundamentals) -- (Part 7) jquery Ajax

Basic jquery tutorial (jQuery Fundamentals) -- (Part 8) jquery plugin

Basic jquery tutorial (jQuery Fundamentals) -- (Part 9) jquery best performance practices

Jquery Fundamentals-(Part 10) jQuery Code Organization

Jquery Fundamentals-(Part 1) jQuery custom events

 

 

Overview

For front-end developers, jquery is becoming a required skill. This book aims to provide a brief view of the jquery library. After you read this book, you should be able to use jquery to complete some basic development tasks, it also lays a solid foundation for further learning. Although the design of this book is organized by means of classroom learning, you will find it helpful for your self-study.

This is a practical course. We will use a small amount of time to understand concepts, and you will have the opportunity to program these concepts for the rest of the time. Some programming practices may seem trivial; others may be terrible. In any case, there is no hierarchy here; our goal is simple: you can choose the appropriate method to learn and solve problems that require jquery to solve. Solutions for all examples of programming practices are included in the sample code.

Get jquery code

In this book we will use jquery code hosted in the Github repository (http://github.com/rmurphey/jqfundamentals ). You can download the source code in the .zips and .tar formats and decompress the source code to apply it to your own development machine. If you are a Git user, you are welcome to copy or complete the repository.

Necessary software for development

If you want to complete most of the courses, you need to prepare the following software tools:

L Firefox

L Firebug extension plug-in for FireFox Browser

L a common text editor

L Ajax development part: the local server (such as MAMP or WAMP), an FTP server, or an SSH client that can access the server.

Add javaScript to your page

Javascript can be added to the page using SCRIPT tags by Inline code or an additional file. It is important to include javascript into the page: the dependent scripts must be introduced into the page before they depend on their scripts.

To improve the page performance, it is best to bring the javascript script closer to the end of the HTML document. It is best to combine multiple javascript script files to introduce them together.

 

Example 1.1: inline javascript

 

<script>console.log('hello');</script>

Example 1.2: javascript that introduces external files

 

<script src='/js/jquery.js'></script>
Javascript debugging

A good debugging tool is required for javascript development. Firefox provides a debugger through the FireBug extension; Safari and Chrome provide a built-in console.

Functions provided by the console:

L single-line and multi-line editor for running javascript

L view the page-generated code Viewer

L a network resource viewer used to check network requests.

 

When writing javascript code, you can use the following method to send messages to the console:

L Console. log () is used to send General log information.

L Console. dir () is used to record objects (directories) that can be browsed)

L Console. warn () is used to record warning information

L Console. error () is used to record error information

 

Although the console methods vary in different browsers, other console methods can also be used. In addition, the console provides the ability to set breakpoints and view expressions for code debugging.

 

Exercise

Most chapters in this book end with one or more exercise questions. For some exercise questions, you can solve them directly on FireBug; but for others, before your jquery script tag is specified to your personal exercise, you need to introduce other dependent scripts.

This book does not cover all jquery development-related information. You need to read the jquery help documentation to complete the exercises. This is what we want to see. The jquery library is quite large. Learning to use help documentation to solve problems is an important part of learning.

Here are some suggestions for solving these problems:

L first, you must fully understand the problems you need to solve

L second, you need to determine which elements you need to access to solve these problems and how to obtain these elements. Then, use FireBug to identify the elements you need.

L finally, determine what operations you need to perform on these elements to solve this problem. Before you write the code, write some comments to explain what you are doing, which is helpful for solving the problem.

Never be afraid of making mistakes! It's never easy to write the code perfectly for the first time! Mistakes and attempts to write code are an important part of learning the jquery class library. In this way, you will soon become a better developer. Examples of solutions to exercise questions are all stored in the/solutions directory of the Instance code.

Some conventions in this book

The method called through the Jquery object is written in the form of $. fn. methodName. The method exists in the namespace of jquery, but will be called in the form of $. methodName if it is not called by the jquery object. If you are not familiar with these conventions, don't worry-as you learn more about the book, you will become more and more clear.

Example 1.3 sample code

// Code examples will appear like this

The remarks are as follows:

 

References

There are many articles and blog posts on jquery on the Internet. Some of them are great, while others are completely incorrect. When you are reading an article about jquery, make sure that the jquery version discussed in this article is the same as what you are using, and we must firmly resist the bad habit of just copying and pasting-take some time to understand the code in the article.

There are some excellent resources that will be helpful when you are learning jquery. Of course, the most important part is jquery's source code itself: it contains the complete class library documentation in the form of code. So it is not a black box for you-if you spend some time accessing it now and in the future, your understanding of the jquery class library will grow exponentially-I strongly recommend that you put its link in your browser tag and read it frequently.

  • The jQuery source
  • JQuery documentation
  • JQuery forum
  • Delicious bookmarks
  • # Jquery IRC channel on Freenode


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.