Recently wrote the set, found that the $ selection ID can not change its own background picture;
Chrom will report the following error:
Uncaught Typeerror:cannot Set Property ' BackgroundImage ' of undefined
jquery Selector $ (#id) returns a JQuery object, with document.getElementById (ID) returning a DOM object
(1) jquery objects can be converted to DOM objects in two different ways, [index] and. Get (Index)
$ (#id) [0] Get DOM object
$ (#id). Get (0)-----"DOM Object
(2) The DOM object is turned into a jquery object:
$ (DOM object)
Note: You cannot use any method of a DOM object in a jquery object.
For example ("#id"). InnerHTML and ("#id"). Checked and the like are all wrong and can be replaced by jquery methods ("#id"). html () and ("#id"). attr ("checked"). Similarly, a DOM object cannot use the jquery method.
jquery ID selector differs from Document.getelementbyidy