+ 2

1.What's error? 2.Can we compare words?

I am confused in conditional statements. Please help me. https://code.sololearn.com/Wbr8S0h9ww5n/?ref=app

21st Aug 2022, 11:07 AM
Shantanu Sharma
Shantanu Sharma - avatar
2 odpowiedzi
+ 3
Add in the form tag: <form onsubmit="myapp();"> And change the js code to: function myapp(){ var x=document.getElementById("ok").value; if(x=="ok"){ alert("hello"); } else if(x=="how") { alert("else if"); } else { alert("else"); } } The form tag needs some more things for correct running. For more info please see here: https://www.w3schools.com/tags/tag_form.asp
21st Aug 2022, 1:07 PM
JaScript
JaScript - avatar