Working with <input> html

If I use some inputs tags, how can I take the given input and use it in JS to output pop-up or other things? This is the code: https://code.sololearn.com/W78Rlhk9Ap3E/?ref=app

26th Jul 2021, 3:57 PM
Stefano De Angelis
Stefano De Angelis - avatar
3 Answers
+ 2
By selecting it like other elements and use value attribute to retrieve the value . If you want to take the input while user types then you can look into "input" event .
26th Jul 2021, 4:18 PM
Abhay - avatar
+ 1
let inp1 = document.querySelector ('[name="First Name"]'), inp2 = document. getElementsByName("Last Name")[0], btn = document. getElementsByName("Confirm")[0]; btn.onclick = function(){ console.log(inp1.value); console.log(inp2.value); }
26th Jul 2021, 5:28 PM
Solo - avatar
Thx for the answers!
28th Aug 2021, 4:47 PM
Stefano De Angelis
Stefano De Angelis - avatar