Jquery is another excellent Javascr into pt framework after prototype. It is a lightweight js Library (only 21 k after compression). It is compatible with CSS3 and various browsers (IE 6.0 +, FF 1.5 +, Safari 2.0 +, and Opera 9.0 + ). JQuery allows you to easily process HTML documents, events, and animation effects, and provides AJAX interaction for websites. Another major advantage of jQuery is its comprehensive documentation and detailed description of various applications. There are also many mature plug-ins to choose from. JQuery can ensure that the user's html page is separated from the code and html content. That is to say, you don't need to insert a bunch of JavaScript code in the html to call the command. You just need to define the id. Pay attention to the following when developing jquery plug-ins.
Notes for developing plug-ins:
1. When writing object-level plug-ins, use the jQuery. fn. extend () method for Function Extension. For Class-level plug-ins, use the jQuery. extend Method for extension.
2. The file name of the plug-in must strictly follow the rules of jQuery. [plug-in name]. js to distinguish it from other js files, such as jquery. newplugin. js.
3. For object-level plug-ins, all methods should be attached to the jquery. fn object. For Class-level plug-ins, all methods should be attached to jquery objects.
4. Both the object-level and class-level plug-ins must end with a semicolon. Otherwise, an error message is displayed when the file is compressed.
5. Although the "$" dollar character can be replaced by the "jQuery" character, do not use the "$" symbol in the code of the plug-in, to avoid conflicts with other codes.
6. In the code inside the plug-in, if you want to access each element, you can use this. each method to traverse all elements.
7. It should be noted that within the plug-in, this represents the object obtained through the jQuery selector, rather than the reference of the object in a non-traditional sense.
8. Because jQuery code can call multiple methods at the same time by using the chain writing method, to ensure the implementation of this function, the plug-in itself must return a jQuery object.
Many plug-in developers have developed a lot of good jQuery plug-ins, but for users of these plug-ins, the use of many jQuery plug-ins is not so direct and transparent. And for plug-in development, if you have a very good architecture, it will bring great benefits to your development. Therefore, before formal development, it is necessary to pay attention to the above jquery plug-in development considerations.