The $ of jquery is another name for jQuery, [$(document)] is to select the entire document object, [$] is the jquery object, [$()] is [jQuery()], in which parameters can be passed , its function is to obtain elements.
Recommended: "jquery video tutorial"
<strong>$</strong>
is another name for jQuery
And jQuery is a function provided by the jQuery library. (It seems that it is not just a function, because there is also the use of $.ajax(options), which is equivalent to jQuery.ajax(options))
The function of this function is to search and select elements in the html document based on the parameters in (). One of the functions of the function is to replace GetElementByID, but () It can be not only ID, but also various selectors
For example:
$(document)
It is to select the entire document object
That is It's not just $ that can be used instead, 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.
Let’s take a look at the difference between using $.
and $().
in jquery. What are their respective meanings?
$
is the jquery object, $() is jQuery(), you can pass parameters in it, and its function is to get the element
The following example
$(".div1") 表示获取类名为div1的元素,例如获取<div class="div1"></div> $(".div1").onclick表示类名为div1的div点击事件 jquery中$.,例如$.post(),$.get(),$.ajax()等这些都是jquery这个对象的方法
Related free learning recommendations: JavaScript (video)
The above is the detailed content of What does $ in jquery mean?. For more information, please follow other related articles on the PHP Chinese website!