0
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
3 ответов
+ 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 .
+ 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);
}
0
Thx for the answers!