Javascript bind submit event

I'm trying to bind an submit event to a button that can't be type="submit" needs to be type="button" I'm trying these to make the required attr validation works

So, can you say what I'm doing wrong here? I'm Googling a lot but didn't find anything yet.

https://jsfiddle.net/2gfnqv6e/28/


Solution 1:

With this code, you can trigger the submit event :

submitBtn.addEventListener('click', function () {
  form.dispatchEvent(submitEvent);
});

However the HTML5 form validation won't work because it requires an actual submit button.

Updated JSFiddle