Home > Article > Web Front-end > Jquery Practice_Reading Notes 1—Choose jQuery_jquery
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