Q: on enter submit a form without type= submit How do I submit a form on enter with type="button"
This is my input field
<input type="text" id = "login-user" class="form-control log-input" placeholder="Username" required="required">
<input type="password" id="login-password" class="form-control log-input" placeholder="Password" required="required">                   
<input type="button" id = "login-submit" class="btn btn-primary log-submit" value="Login" onclick = loginsubmit()>


I do not want to use type="submit" can I do it with type="button" or any other approach?

A: You can use the code below to submit a form after pressing Enter.
<input id="videoid" placeholder="Enter the video ID">
<button id="mybutton" type="button" onclick="myFunction()">Submit</button>

<script>
var input = document.getElementById("videoid");
input.addEventListener("keyup", function(event) {
  if (event.keyCode === 13) {
   event.preventDefault();
   document.getElementById("mybutton").click();
  }
});
</script>


A: Using jQuery you would do something like this:
// Catch enter key stroke in input field
$('#somefield').on('keyup', (e) => {
  if (e.code === 13 || e.keyCode === 13) {
    e.preventDefault()
    // Submit your form
    $('#form').submit()
  }
})

