around this issue getElementById returns a DOM element object. $ returns a jQuery object. Passing it a string containing an id selector causes it to populate the jQuery object with a DOM element object.
Difference between $(this).src and document.getElementById().src?
By : David Grubs
Date : March 29 2020, 07:55 AM
should help you out in a current project I am using jQuery. I was just wondering why this works, , In jquery you should do