Answers for "enter value in input javascript"

4

input enter button js

// Get the input field
var input = document.getElementById("myInput");

  
input.addEventListener("keyup", (event) => {
    if (event.key === "Enter") {
        // Cancel the default action, if needed
        event.preventDefault();
        // Trigger the button element with a click
        document.getElementById("myBtn").click();
    }
})
Posted by: Guest on April-27-2021
19

javascript set input field value

document.getElementById("myInputID").value = "My Value"; //set value on myInputID
Posted by: Guest on August-05-2019

Code answers related to "enter value in input javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language