published under license CC4-BY
posted in category Software Development & Programming / JavaScript
posted at 29. Apr '23
How To Get Native DOM Node From jQuery Finder
I will write in ES6 and modules, but we all know how jQuery code looks in reality.
import $ from 'jquery'
// wrapper, use jQuery functions on this
const images = $('.image')
// native DOM element and you can use vanilla JavaScript
images[0]
// or iterate
images.each(function(i) {
this.innerHTML = `woof ${i}`
})
More details: https://learn.jquery.com/using-jquery-core/faq/how-do-i-pull-a-native-dom-element-from-a-jquery-object/
Add Comment