crop_rotate
Run
<!DOCTYPE html> <html> <head> <title>CloseTag | addEventListener</title> <style> #myBtn { Background-color:#007bff; color:white; padding:10px; border:none; } p { padding:0px; } </style> </head> <body> <h1 id="h1">CloseTag addEventListener</h1> <p id="paragraph">this element will take class color when clicked<p> <button id="myBtn">Click</button> <script> let myBtn = document.getElementById("myBtn"); let h1 = document.getElementById("h1"); let paragraph = document.getElementById("paragraph"); myBtn.addEventListener("mouseover", function(){color()}); myBtn.addEventListener("click", function(){hover()}); myBtn.addEventListener("mouseout", function(){background()}); function color() { paragraph.style.color = "blue"; } function background() { paragraph.style.backgroundColor = "orange"; } function hover() { paragraph.style.padding = "10px"; } </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxoZWFkPg0KICA8dGl0bGU+Q2xvc2VUYWcgfCBhZGRFdmVudExpc3RlbmVyPC90aXRsZT4NCiAgPHN0eWxlPg0KICAjbXlCdG4NCiAgew0KICAgIEJhY2tncm91bmQtY29sb3I6IzAwN2JmZjsNCiAgICBjb2xvcjp3aGl0ZTsNCiAgICBwYWRkaW5nOjEwcHg7DQogICAgYm9yZGVyOm5vbmU7DQogIH0NCiAgcA0KICB7DQogIHBhZGRpbmc6MHB4Ow0KICB9DQogIDwvc3R5bGU+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPiA6Oi13ZWJraXQtc2Nyb2xsYmFye3dpZHRoOjdweDtoZWlnaHQ6N3B4O306Oi13ZWJraXQtc2Nyb2xsYmFyLXRyYWNre2JhY2tncm91bmQ6I2ZmZjt9Ojotd2Via2l0LXNjcm9sbGJhci10aHVtYntib3JkZXItcmFkaXVzOjVweDtiYWNrZ3JvdW5kOiMyZjQ1ZmY7fTwvc3R5bGU+PC9oZWFkPg0KPGJvZHk+DQo8aDEgaWQ9ImgxIj5DbG9zZVRhZyBhZGRFdmVudExpc3RlbmVyPC9oMT4NCjxwIGlkPSJwYXJhZ3JhcGgiPnRoaXMgZWxlbWVudCB3aWxsIHRha2UgY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