0

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/

Brian Tompsett - 汤莱恩
5,92772 gold badges64 silver badges135 bronze badges
asked Apr 15, 2016 at 13:35

1 Answer 1

2

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

answered Apr 15, 2016 at 13:47
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.