How can I disable the try it button until text is entered in input | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

How can I disable the try it button until text is entered in input

<label for="fname">Name</label> <input type="text" id="v" name="firstname" placeholder="Your name.." required> <button class="btn1" onclick="f()" disabled>Try it</button> function f() { var i; var a = ["Se", "Q", 1]; var p = document.getElementById("v").value; for(var i = 0; i < a.length; i++) { if (a[i] == p) { alert("good"); document.getElementById("no").innerHTML = "Congrats"; } } } How do I remove the disabled button when 3 of those words from var a Are inputted

2nd May 2018, 10:38 PM
klisco1
1 Réponse
0
Thanks but onkeyup="f()" means what , what is the function
3rd May 2018, 8:48 AM
klisco1