1<form name="myform" action="handle-data.php" method="post">
2 <label for="query">Search:</label>
3 <input type="text" name="query" id="query"/>
4 <button>Search</button>
5</form>
6
7<script>
8var button = document.querySelector('form[name="myform"] > button');
9button.addEventListener(function() {
10 document.querySelector("form[name="myform"]").submit();
11});
12</script>
13