btn1<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Get element by id</title>
</head>
<body>
  <div class="container">
    <button type="button" id="btn1">GET ELEMENT</button>
    <div id="get-me">GET ME</div>
  </div>
  
</body>
</html>
body{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.container{
  width: 50%;
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

#get-me{
  width: 150px;
  height: 150px;
  background: #ab3f69;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2em;
  color: white;
}

button{
  width: 150px;
  height: 50px;
  margin-bottom: 10px;
}
//First we get element by id 
//and after that we add event listener that
//will listen to the click event

//event listener
document.getElementById("btn1").addEventListener("click", (e)=>{
  var get_me = document.getElementById("get-me");
  get_me.innerText = "CHANGE";
  // get_me.innerHTML = "<p>CHANGE</p>";
  console.dir(get_me);
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.