JQuery challenges to Pure Javascript

JQuery challenges to Pure Javascript
0

#1

Hey y’all, so I’m trying to do the jqery parts of FCC in native javascript because I read it’s better to learn that way than rely on libraries. I’m doing the “Change text with click events” challenge. The jquery answer is:
$(document).ready(function() {
$("#getMessage").on(“click”, function(){
$(".message").html(“Here is the message”);
});
});

and the js I have so far is
document.querySelector("#getMessage").onclick = function(){
document.querySelectorAll(".message").innerHTML = “Here is the message”;

Can someone try and help me please?


#2
document.addEventListener('DOMContentLoaded', function () {

  var messageBtn = document.querySelector("#getMessage"),
    message = document.querySelector(".message");

  messageBtn.addEventListener("click", function () {
    // Only change code below this line.
    message.innerHTML = "Here is the message";
    // Only change code above this line.
  });

});