staff I'm trying to make an input of type text, and what I type in it I want to play inside a variable?

1
<input id="a_input" type="text" >

var b = document.getElementById ('a_input'). innerText = '';

    
asked by anonymous 13.07.2018 / 03:39

1 answer

0

Do not use innerText , use value :

var b = document.getElementById('a_input').value;
alert(b);

We use innerText for objects that can have content in html , such as div and span , to get the content text, and if you want content in html, innerHTML

    
13.07.2018 / 03:46