Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

this js

document.querySelector("button.w").addEventListener("click", function () {
    this.style.color = "white";
});
// In HTML event handlers, this refers to the HTML element that received the event:
// when clicked color of the element would change to white, 
// document.querySelector("button.w") indentifies the element.
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js
ADD COMMENT
Topic
Name
6+7 =