Home  >  Article  >  Web Front-end  >  Jquery Practice_Reading Notes 1—Choose jQuery_jquery

Jquery Practice_Reading Notes 1—Choose jQuery_jquery

WBOY
WBOYOriginal
2016-05-16 18:36:001011browse

After comparing multiple JavaScript frameworks, I have to admit that JQuery is really an excellent framework. If you haven't used it in your framework yet, throw away those bloated and inconvenient frameworks. This will save a lot of code in your front-end design.

Why choose Jquery
When we write javascript code on the page, you may find that you often have to follow such a pattern: select an element or a group of elements, and then operate it in some way ( Such as showing and hiding elements, adding CSS classes to elements, and modifying element properties). jQuery has a more superior implementation than other frameworks in this regard, making the entire code more concise.


Separation of page and implementation
Just like css styles, when we design web, we should try to separate the style tags and html documents, and separate the style description of html into css files , which is not only easy to process documents, but also we can easily change the style of the entire page, just by modifying the style sheet.


Advantages of Jquery
1. Powerful Dom element selector
Jquery provides a set of powerful selector functions. Using Jquery's selector, we can use simple code to To select complex elements or sets of elements on the page, through jquery, tasks that originally required many lines of code can be completed with only a few lines of code (or even one line of code).
Selects all even-numbered

elements.
$("p:even")
Select the first row of each table.
$("tr:nth-child(1)")
Select the

that is the direct child of
Link
$("a[href$=pdf]")
Select the

$("body > div that contains the link () as a direct child of : has(a)")

Think about the above dom element selections. If you don’t use the selector provided by jquery, how do you need to implement it? How much code does it take to complete?
2. Easy to expand
Since Jquery provides a convenient expansion mechanism, you can find many easy-to-use extension plug-ins to enhance our use

3. Convenient dom operation method
4. Lightweight and lightweight
Compared to the huge and bloated Extjs, jquery is really too small. I don’t need to say more about this.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn