I want my button so that when it is clicked, it will also press enter on an input field. I am using Google Maps API, place search box.(https://developers.google.com/maps/documentation/javascript/examples/places-searchbox)
I also added in code so that the API will ask permission for your location. Here is my button and input field code.
HTML
<form>
<button type="submit" id="go" value="Food near me">Click</button>
<input id="pac-input" type="text" placeholder="">
</form>
Javascript
document.getElementById('go').onclick = function () {
document.getElementById('pac-input').value = this.value;
};
As you can see, when the button is pressed, "Food near me" is added to the pac-input input. But in order for it to display the results, I have to press the enter key inside the input field, I want the results to show when I mouse click the button