Friday, October 18, 2013

When using jQuery, but also the only call it more briefly, allegro $ (name


Speaking to the web, make sure everyone has used or heard of jQuery, allegro a very famous javascript library. Please post your introduction to jQuery is, the benefits and how to use it? What is jQuery?
As stated allegro above, we use jQuery for DOM processing on site. When no jQuery (and the same library), we will have to handle DOM very very very hard, for example, will often be called document.getElementByTagName allegro (name> tag>) allegro to obtain element to manipulate, will be html yourself allegro browse node tree.
When using jQuery, but also the only call it more briefly, allegro $ (name> tag>). Not only that, $ () is very special to specifically allow you to choose a random element on the page without having to browse sequentially, ... Once you "get" is the element on the page at your convenience, you 'll be spoiled transform, animate allegro them, from the text changes color, background color, making it flying across the screen, zoom in, ... to change the contents without having to reload the whole page Ajax techniques. How to use jQuery?
Using jQuery is very simple, allegro just like any other javascript libraries, HTML tag must be imported using <script/>. On jQuery homepage to download and put on your source, then import the html page:
In the above example, I downloaded and put in the jQuery library allegro js folder at the same level with htm file is code. You can put anywhere, free to declare the correct path. Or you can directly embed js from other hosting, use 1 of the following 3 lines:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"> </ script> <script src = "http://ajax.googleapis.com/ajax/libs/jquery / 1.10.2/jquery.min.js "> </ script> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js"> </ script>
Of course you will need to code jQuery allegro / elementary JavaScript <script> within a certain allegro card. To start coding with jQuery, you have to understand the most important thing, which is the Selector - the syntax to specify the exact element to retrieve the HTML document. You will easily get to know if you ever use a regular HTML Designer and work with CSS. Because allegro of jQuery Selector syntax is almost identical allegro to the CSS selector. Example 1: Embedding jQuery allegro in preparing documentation and code
<html> <head> <script src="http://code.jquery.com/jquery-1.10.1.min.js"> </ script> <script> $ (document). ready (function () { / / will write our code here}); </ script> </ head> <div class="ted"> <body> Something here! </ div> <p> is a beautiful jQuery js lib. < / p> <body> </ html>
<Head>
</ Html> On line 5, it seems like longer than expected lines? No, you just have to write this line one time and can attack allegro all code inside this function if lazy to type it again. In fact, the place where js code is running well, why not stuffed into blocks of code lines 5? If you do not put code in jQuery event handling allegro "document allegro ready" it's likely that code will not work as expected. You know, the components allegro on site takes time to download to your computer. If placed in <head> js code running before the end of the HTML page has not finished loading - jQuery selector will not find that object. allegro Even missed you write the code executed before jQuery source file download, will soon undefined error ... Example 2: made in the text of the paragraph p tag color to blue
Name *
Yii Tutorial allegro # 2 create simple personal blog - Part 3 October 08, 2013
You do love the web? you like writing? Sign up for an account and funding public right <3 Recent Comments on Yii Huang Title # 2 How to Create a simple personal blog - Part 1 restart on Yii Tutorial # 2 create simple personal blog - Part 1 Jason Le on Get familiar with Yii Javascript Tutorial # 2 create simple allegro personal blog - Part 3 - webFaver allegro on Yii Tutorial # 2 create simple personal blog - Part 2 Yii Tutorial # 2 create simple personal blog - Part 3 on Yii Tutorial # 2 create simple personal blog - Part 1 Category Client Side (4) JavaScript (4) jQuery (2) PHP Coding (1) Yii Framework (6) Basic (1) Tutorial (4 ) Meta Register Log in Entries RSS Comments RSS WordPress.org allegro
Hiero by aThemes

No comments:

Post a Comment