JS DOM: input text field
Input Text Field Example
Result:
Code
<div class="mKvVM"> <label for="input_hnjd">Name:</label> <input id="input_hnjd" type="text" size="20" maxlength="20" name="user_name" value="" placeholder="Enter name..."> </div> <div class="mKvVM"> Result: <span id="output_smjs"></span> </div>
{ const input_hnjd = document.getElementById("input_hnjd"); const output_smjs = document.getElementById("output_smjs"); const f_update = () => { output_smjs.textContent = input_hnjd.value; }; input_hnjd.addEventListener("input", f_update); f_update(); }