Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

add class on javascript onclick function

document.addEventListener('click', function handleClick(event) {
  console.log('user clicked: ', event.target);

  event.target.classList.add('bg-yellow');
});
Source by bobbyhadz.com #
 
PREVIOUS NEXT
Tagged: #add #class #javascript #onclick #function
ADD COMMENT
Topic
Name
5+1 =