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
Post a Comment