In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces what the jquery object means, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
In jquery, the jquery object is the object that can get the DOM elements of the page through its own method, which is obtained by using the class library selector of jquery, and is the object produced after wrapping the DOM object through jquery; the jquery object can use the methods in jquery, but not the methods of DOM.
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
What is a jquery object
In the JQuery library, objects that can get DOM elements of a page through their own methods are called JQuery objects. The object is defined with the beginning of var.
In the JQuery library, objects that can get page elements through their own methods are called JQurey objects.
The jQuery object is the object obtained using jQuery's class library selector. The JQuery object is the object that results from wrapping the DOM object through jQuery.
The JQuery object is unique to jQuery and can use methods in jQuery, but not methods in DOM.
For example: $("# img") .attr ("src", "test.jpg-600"); the $("# img") here is the jQuery object.
Note: you cannot use any methods of the DOM object in the jQuery object.
Words such as $("# id") [xss_clean] and $("# id") .clients are incorrect and can be replaced by jQuery methods such as $("# id"). Html () and $("# id"). Attr ("checked").
Similarly, the jQuery method cannot be used for DOM objects.
Convert DOM object to jQuery object
If you are already a DOM object, you only need to wrap the DOM object with $() to get a jQuery object, $(DOM object) Note: var is the definition variable
Such as:
Var v = document.getElementById ("v"); / / DOM object var $v = $(v); / / jQuery object
After the conversion, you can use the method of jQuery at will.
Convert jQuery object to DOM object
Two conversion methods convert a jQuery object into a DOM object: [index] and .get (index)
The jQuery object is a data object, and the corresponding DOM object can be obtained by [index] method.
Such as:
Var $v = $("# v"); / / jQuery object var v = $v [0]; / / DOM object alert (v.checked); / / check whether this checkbox is selected. Thank you for reading this article carefully. I hope the article "what is the meaning of jquery object" shared by the editor will be helpful to you. At the same time, I hope you will support us, pay attention to the industry information channel, and more related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.