<input name="searchTxt" type="text" maxlength="512" id="searchTxt" class="searchField"/>
Asked by user979331
There are several ways to access the value of an input textbox without having to enclose the input element in a form element:
Browser Method1 Method2 Method3 Method4 Method5/6 IE6 Y(Buggy) N Y Y(Buggy) N IE7 Y(Buggy) N Y Y(Buggy) N IE8 Y N Y Y(Buggy) Y IE9 Y Y Y Y(Buggy) Y IE10 Y Y Y Y Y FF3.0 Y Y Y Y N IE=Internet Explorer FF3.5/FF3.6 Y Y Y Y Y FF=Mozilla Firefox FF4b1 Y Y Y Y Y GC=Google Chrome GC4/GC5 Y Y Y Y Y Y=YES,N=NO Safari4/Safari5 Y Y Y Y Y Opera10.10/ Opera10.53/ Y Y Y Y(Buggy) Y Opera10.60 Opera 12 Y Y Y Y Y
Answered by bugwheels94
In codepen, you can see how this works.
Answered by maudulus
I’d make a variable to hold the data like this:
var input = document.getElementById("input_id").value;
Then I’d simply add the input value to the string using the variable.
= input + “your string”;
Answered by Vadim Tatarnikov
You should be able to type the following:
Answered by Fredrik A.
You can also call by tag names, such as form name.input name.value, to get the specific value of a determined input in a particular form.
Answered by user3768564