How to assign a value from <input> to a variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to assign a value from <input> to a variable?

Html <input type="text" id="answer"> <button onClick="verifyText" >Verify</button> JS function verifyText () { var x = "It is a text" ; If (x == y) { alert('hello world') } } How can i do y as a text from input How to assign y a value from the input

14th Jul 2019, 12:05 PM
Alex
Alex - avatar
1 Answer