The best jQuery syntax Tutorial In 2024, In this tutorial you can learn jQuery syntax,Document ready event,
By jQuery, you can select (query, query) HTML elements, and they perform the "operation" (actions).
jQuery syntax is to perform certain actions by selecting HTML elements, and selected elements.
Basicgrammar:. $ (Selector) action ( )
Example:
$ (This) .hide () - Hide elements
$ ( "P") hide () -. Hide all <p> elements
$ ( "P.test") hide () -. Hide all class = "test" the <p> element
$ ( "# Test") hide () -. Hide all id = "test" element
CSS selectors you familiar with it? JQuery syntax using a combination of CSS selectors and XPath syntax. In the next section of this tutorial, you'll learn more about the selector syntax. |
You may have noticed that in our case all the jQuery functions in a document ready function:
This is to prevent the document is fully loaded operation (ready) before jQuery code.
If the function is run before the document is not fully loaded, the operation might fail. Here are two specific examples:
Tip: simple writing (written with the same effect as above):
These two ways you can choose your favorite way to achieve the implementation of jQuery method after the document is ready.