$ object
When it comes to jquery, the most obvious sign, no doubt, is, in fact, a shorthand for jquery. Objects that use the $ () wrapper are jquery objects
Corresponding to the JQuery object is the DOM object, which is actually a DOM element node object
If you write document directly, you are referring to the DOM element object of document
Document.onclick = function () {
alert (' Dom ');
}
if () included () included, such as (document), the shorthand form of jquery (document), the jquery object
<script src= "Jquery-3.1.0.js" ></script>
<script>
console.log (jquery (document));//[ Document]
Console.log ($ (document))//[document]
Console.log (document)//#document
</script>
[Note that the]jquery object cannot use the DOM object's method, nor can the DOM object use the JQuery object method
<script src= "Jquery-3.1.0.js" ></script>
<script>
//No reaction
$ (document). onclick = function () {
alert (0);
};
Uncaught TypeError:document.click is not a function
Document.click (function () {
alert (1);
});
</script>
Transformation
"1" Dom goto jquery Object
For a jquery object, you can get a jquery object by wrapping the DOM object with $ ()
"2" jquery turn DOM Object
jquery is a class array object that can be obtained by [index] or get (index) to the corresponding DOM object
Console.log (document = = $ (document) [0]);//true
console.log (document = = $ (document). Get (0));//true
Coexistence
If the jquery object and the DOM object point to the same object and bind different functions, the functions are executed sequentially
Pop 0 First, then eject 1
document.onclick = function () {
alert (0);
}
$ (document). Click (function () {
alert (1);
});
The above is a small set to introduce the JQuery object $.html, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!