There have been some methods that have been used by jquery to make it impossible to directly use JavaScript, and it is not understood at the beginning, and now the case knows that the object that jquery obtained is not the same object that we normally get with getElementById. So some novice is very confused, why ${"#Element"} can not directly InnerHTML, this is the reason, the solution please see below.
conversion of jquery objects to DOM objects
only jquery objects can use the methods defined by jquery. Note that DOM objects are different from jquery objects, and you should be aware of whether you are manipulating DOM objects or jquery objects when calling methods.
Normal DOM objects can generally be converted to jquery objects through $ (). can 500% improve the development efficiency of the front-end UI Framework!
such as:
$ (document.getElementById ("MSG"))
is a jquery object, you can use the jquery method.
Because the jquery object itself is a collection. So if a jquery object is to be converted to a DOM object, it must take one of these items, which is generally available through the index.
Such as:
$ ("#msg") [0],$ ("div"). EQ (1) [0],$ ("div"). get () [1],$ ("TD") [5]
These are DOM objects, and you can use the methods in the DOM, but you can't use jquery any more. A front-end UI framework that can 500% improve development efficiency!
The following are the correct ways to do this:
$ (" #msg "). html (); $ (" #msg ") [0].innerhtml;$ (" #msg "). EQ (0) [0].innerhtml;$ (" #msg "). Get (0). InnerHTML;
The conversion of jquery objects to DOM objects