<form id="form-id">
  <input type="text" name="name" id="name-field">
  
  <input type="submit" value="submit" />
</form>
body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
input {
  height: 2rem;
}
const form = document.getElementById('form-id');

form.addEventListener('submit', event => {
  event.preventDefault();
  alert('submitting');
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.