I have been using JavaScript for about two years and have been attracted by its concise and elegant code. I recently came into contact with the JQuery library. It feels good, but it does not mean that I should discard JavaScript, instead, it promotes combined use. to put it this way, only with solid JavaScript skills can we use various JS libraries with ease, and then let's get started!
1. Let's talk about JQuery's efficiency first. His selector speed is about 4 times slower than the standard JS Dom (officially speaking, not my NLE...). Why should we use it ?? The reason is very simple. JS is the application client, and the speed impact is not that obvious, but be sure to pay attention to when to use the JQuery selector and when to use the JavaScript selector!
I personally understand this. If the logic is easier when selecting an object, do not use the JQuery selector, for example
Then, simply perform the verification without complicated operations. Use document. getElementById ("name") directly ");
Don't use JQuery $ ("# ID") as it looks convenient. But if you want to perform complicated and logic operations, use JQuery. For example, there are 10
We select this option to delete the row where they are located.
$ ("Input [checked]"). parent (). parent (). remove (); this method of writing is logical and maintainability!
2. Let's talk about cross-browser In general, JavaScript code is written. If you want to run it without passing through the browser, some methods are not supported by the browser and must be modified. JQuery is doing well in this regard, supports mainstream browsers, so that a code can be used in multiple browsers.
3. Let's talk about "zonghai development" Currently, development focuses on high speed, high quality, and easy maintenance. Traditional JavaScript can be written from the beginning, but it will have a great impact on the development progress, JQuery has a wealth of plug-in libraries, which greatly improves development efficiency. You may say that so many plug-in libraries are exhausted, but JQuery has done a good job in this regard, each plug-in has detailed annotations and Domo, which can be easily put into practical application.
This is my first time writing something. If it is not well written, don't be angry. The next article will introduce some tips for using javascript and JQuery in actual development. Thank you.
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.