I have a form that consists of a textbox and a functioning submit button which executes a jQuery/AJAX function. I am looking to trigger the same function when the user selects the textbox and presses the 'Enter' key.
I attempted to set up the textbox to initiate the function, but encountered issues where either the text input stopped working entirely or the function was not properly called (e.g., it simply added a parameter to the URL and refreshed the page, rather than executing the intended function). How can I resolve this?
Below is the code for my form:
<form style="border: 1px solid;border-radius:5px;" >
<div class="input-group mb-2 mr-sm-2 mb-sm-0">
<input type="text" class="form-control" id="mytextbox" placeholder="ID #" name="parcel">
<span class="input-group-btn">
<button class="btn btn-success" id="btnSearch3" type="button" onclick="foo('parcel',document.getElementsByName('parcel')[0].value,'Wizard')">Search</button>
</span>
</div>
</form>