Before learning jQuery, you need to have the following basic knowledge: HTMLCSSJavaScriptjQuery basic syntax $ (selector ). action () $ conforms to the definition. This is a jQuery Statement (selector) used to select an HTML element. Its syntax is the same as the selector Syntax of CSS. Act... before learning jQuery, you need to have the following basic knowledge: HTMLCSSJavaScriptjQuery basic syntax $ (selector ). action () $ conforms to the definition. This is a jQuery Statement (selector) used to select an HTML element. Its syntax is the same as the selector Syntax of CSS. Action () defines the method to operate the HTML element. For example: $ (this). hide ()-hide the current element. $ ("p"). hide ()-hide so
Element. $ (". test "). hide ()-hides the element named test. $ ("# test "). hide ()-hides the element whose ID is test. Document Preparation events almost all jQuery has the following code: [javascript] $ (document ). ready (function () {// jQuery methods go here ...}); $ (document ). ready (function () {// jQuery methods go here ...}); this is the Document Ready event processor to prevent jQuery from being executed before the page is loaded. In this way, we can avoid the following situations: Try to hide elements that have not been created and try to obtain the size of images that have not been loaded. This method can also be simplified as follows: [javascript] www.2cto.com $ (function () {// jQuery methods go here ...}); $ (function () {// jQuery methods go here ...}); you can choose the method you like, but usually use $ (document ). ready (function () {is used to facilitate code reading.