Answers for "press button javascript"

3

hit enter button lick in js

<form>
    <input id="myInput" placeholder="Some text.." value="">
    <input type="submit" id="myBtn" value="Submit">
</form>

<script>
var input = document.getElementById("myInput");
input.addEventListener("keyup", function(event) {
    if (event.keyCode === 13) {
        event.preventDefault();
        document.getElementById("myBtn").click();
    }
});
</script>
Posted by: Guest on May-25-2020
0

javascript click button by id

var button = document.getElementById("button");
button.click();
Posted by: Guest on May-20-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language