Template:Buttontest.js
Revision as of 16:34, 21 June 2024 by BlueYoshi 57EML (talk | contribs) (BlueYoshi 57EML changed the content model of the page Template:Buttontest.js from "JavaScript" to "wikitext")
const element = document.querySelector("body")
let taskDone = false // function for show button const elementShow = () => { element.innerHTML = ` <button id="done-button" style="background-color : ${!taskDone ? "#4dd432" : "#fd67ad"};" onclick=doneTask()> ${!taskDone ? "Done" : "not done yet"} </button> ` } elementShow()
// click Done button const doneTask = () => { taskDone = (taskDone ? false : true) elementShow() }