In jquery, "$" means "get", which is mainly used to get element objects. By getting the object, you can use the jquery method to operate it; the syntax is "$(selector)".
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
$
in jQuery represents the meaning of acquisition, which is equivalent to document.getElemenById("id name")
; of course, it is also equivalent to document. getElementsByClassName("class name")
and so on are the same as above. The
$
symbol is mainly used to obtain the element object. By obtaining the object, you can use the jquery method to operate it.
$ is actually another name for jQuery, which refers to the jQuery object, and jQuery is a function provided by the jQuery library
The function of this function is to search and select html based on the parameters in () For elements in the document, one of the function functions is to replace GetElementByID, but () can not only be ID, but also various selectors
For example:
$(document )
It is to select the entire document object
Can it only be replaced by $? No. To prevent naming conflicts, the jQuery library provides additional mechanisms to give jQuery functions additional aliases.
For example:
var jq = jQuery.noConflict(); // Do something with jQuery j("div p").hide(); // Do something with another library's $() $("content").style.display = 'none';
You can use jq instead of jQuery and $ in the code.
To put it simply, $ is the jquery object, $() is jQuery(), in which parameters can be passed, and the function is to obtain elements.
Recommended related video tutorials: jQuery Tutorial (Video)
The above is the detailed content of What does $ mean in jquery?. For more information, please follow other related articles on the PHP Chinese website!