skip to Main Content

Why doesn't this document.innerHTML function work?

I am not sure why if you trigger the function, nothing happens loginButton.addEventListener("click", function() { const password = document.getElementById("password").value; if (password === "password") { alert("Correct!"); document.innerHTML = <embed src="http://stackoverflow.com" style="width:500px; height: 700px;"></embed>; } else { loginMessage.textContent = "Invalid password."; }…

VIEW QUESTION

Html – How to change href using javascript function?

I have a button, that when a user clicks on it, The page will be redirected to another link. Index.html: <input type="text" placeholder="Search" id="input-box" autocomplete="off" style="width: 250px;"> <button id="submitbtn" onClick="submitClicked" href=""> </button> </input> Script.js: document.getElementById("submitbtn").onclick = function() {submitBtn()}; function submitBtn()…

VIEW QUESTION
Back To Top
Search