I have to code a website, I have my homepage and I want to add an input in my HTML and to add in my JavaScript a function who check if the word is the same in Javascript. I don’t know if this clear so there is my HTML:
<div class="secretword" id="english">
<p>Clues have been placed on the different pages to form a word, find it! <input id="secret" autocomplete="off"><button onclick="secret()">Done</button></p>
</div>
and my function:
function secret() {
var secretInput = document.getElementById("secret").value;
var mot = "nsi";
console.log("secretInput");
if (secretInput === mot) {
var bravo = document.getElementById('bravo');
bravo.innerHTML = "right";
}
}
It just need to check if the input is “nsi”, and then return “right”.
This website is just for me, in local. So i don’t need php, sql or other language.
FikiTheKiki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.