Use .textContent over .innerText
textContent is the w3c standard and more performant
innerText only return human readable text. no hidden elements.
innerText was originally proprietary IE, but now widely supported.
const var = document.getElementById("htmlId");
const var = document.querySelector("#htmlId");
const inputBtn = document.getElementById("input-btn")
inputBtn.addEventListener("click", function() {
console.log("input button clicked...");
}
The following are two methods of updating list items.
Using innerHTML is easier and less code, but the createElement method is preferred as innerHTML is vulnerable to XSS attacks, and using innerHTML can destroy existing event listeners on child elements since those nodes get replaced with fresh ones.
ulEl.innerHTML += "<li>" +"gagf + "</li>"
//////////////////////////////////////////////
const li = document.createElement("li")
li.textContent = "gagf"
ulEl.append(li)
need a site.webmanifest file with a json object
{
"name": "My big awsome new app",
"short_name": "Awesome App",
"icons":
[
{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}