Using a textbox in HTML

A textbox in HTML looks like this:

The code for this looks like:

<input id="textbox" onchange="getInput()"></input>

When the enter key is pressed, the getInput() function will be run.

In order to use the data entered into the textbox, you look at the value property like this:

inputText = document.getElementById('textbox').value;

Comments

Leave a comment