Get the first element in the document matching selector. Shorthand for querySelector.
querySelector
DOM selector
Optional context element for DOM query
The first element matching the selector, or null if no match
const $elA = $('.foo')const $elB = $('#bar')const $elC = $('section') Copy
const $elA = $('.foo')const $elB = $('#bar')const $elC = $('section')
Get the first element in the document matching selector. Shorthand for
querySelector.