javascript es6 dom manipulation code example

Example 1: javascript es6 dom manipulation

const myChildElemet = myElement.querySelector('input[type="submit"]')

// Instead of
// document.querySelector('#foo > div.bar input[type="submit"]')

Example 2: javascript es6 dom manipulation

const myElements = document.querySelectorAll('.bar')

Example 3: javascript es6 dom manipulation

myElement.matches('div.bar') === true

Example 4: javascript es6 dom manipulation

const myElement = document.querySelector('#foo > div.bar')