Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

multiple classes

//-----------used in chat App -------
var allChat = document.querySelectorAll('div[class^=chat-people]');
console.log("Found", allChat.length, "div which class starts with “chat-people”.");

intro = document.getElementById('intro-right');

for (var i = 0; i < allChat.length; i++) {
    allChat[i].addEventListener('click', function() {
    console.clear();
    console.log("You clicked:", this.innerHTML);
       });
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #multiple #classes
ADD COMMENT
Topic
Name
9+6 =