skip to Main Content

Javascript – How to detect whether each element of a list of element-nodes does feature a specific css-class name?

Given the following test environment ... const nodeList = document.querySelectorAll('p'); const testArray = Array.from(nodeList); testArray.every(function (elmNode) { if (elmNode.classList.contains('ipsum')) { console.log( 'All element nodes do feature the `ipsum` css-class name.' ); } }); .lorem { font-family: courier new, courier; }…

VIEW QUESTION
Back To Top
Search