JavaScript Snippet

 <script>

    var listElement = document.getElementsByClassName("first");
    var statusVal = document.getElementById("bookStatus");
    var colorBg = document.getElementById("buyBtn");
    var buy = document.getElementById("firstCell");
    var available = document.getElementById("bookAvailable");

    colorBg.addEventListener("click", () => {
      // console.log("Success! addEventListener is working")
      // colorBg.innerHTML = "Success! addEventListener is working";
      available.classList.add("sample");
      statusVal.classList.add("sample");
    });

    function buyBook() {
      buy.innerHTML = "You bought this book!";
      statusVal.innerHTML = "Sold Out";
    }
  </script>

Comments

Popular posts from this blog

Generative AI Model for text summarization

maintext/ react

Resume description for AI/ ML Developer