Home > Article > Web Front-end > Several features of jQuery that we must understand_jquery
jQuery is a script library, not a script framework. "Library" is not equal to "framework". For example, "System Assembly" is a class library, and "ASP.NET MVC" is a framework. jQuery cannot help us solve script problems. Reference management and function management, these are what the script framework does.
The script library can help us complete coding logic and realize business functions. Using jQuery will greatly improve the efficiency of writing JavaScript code, making the written code more elegant and robust. At the same time, the rich jQuery plug-ins on the Internet also allow us Our work has become "With jQuery, drink tea every day" - because we are already standing on the shoulders of giants.
1. Provides powerful functional functions
Using these functions can help us quickly complete various functions and make our code extremely concise.
2. Solve browser compatibility issues
The compatibility of JavaScript scripts in different browsers has always been a nightmare for web developers. Often a page runs normally under IE, but inexplicable problems occur under Firefox. Writing different scripts for different browsers is a piece of cake. Painful thing. With jQuery we will wake up from this nightmare. For example, the Event object in jQuery has been formatted to be common to all browsers. In the past, we had to get the event trigger based on the event. In IE, it was event.srcElements. Standard browsers such as ff use event.target. jQuery unifies event objects, allowing us to use event.target to obtain event objects in all browsers.
3. Implement rich UI
jQuery can achieve animation effects such as gradient pop-up, layer movement, etc., allowing us to obtain a better user experience. Taking the gradient effect as an example, I once wrote a gradient animation that was compatible with IE and FF, and used a lot of The implementation of javascript code is not only a lot of work, but it doesn’t help much after writing it and is forgotten after a while. It will take a lot of effort again to develop similar functions. Now using jQuery can help us quickly complete such applications.
4. Scripting knowledge to correct errors
I proposed this because most developers have a wrong understanding of JavaScript. For example, writing statements to operate the DOM that are executed when loading in the page, directly adding "onclick" to the HTML element or document object Attributes, I don’t know that onclick is actually an anonymous function, etc. Technical personnel with knowledge of these error scripts can also complete all development work, but such a program is not robust. For example, "write operations in the page that are executed when loading DOM statement", when the page code is small and the user loads it quickly, there is no problem. When the page loads a little slowly, the browser "terminates the operation" error will occur. jQuery provides many simple methods to help us solve these problems. Using jQuery you'll have the knowledge to correct these mistakes - because we all use standard correct jQuery scripting methods!
The above is the entire content of this article. Of course, this cannot summarize the characteristics of jQuery. There are still many things to discover.