Change onsumbit attribute on click?

How to do that would be by clicking on the button has changed form attribute onsubmit?

I tried to do so, but didn't work.

let form = document.querySelector('#modal-order .form');
let buttonHeader = document.querySelector('#button-header');
buttonHeader.addEventListener('click', function () {
form.onsubmit = '1';
April 4th 20 at 00:59
1 answer
April 4th 20 at 01:01
What specifically do you want to do?
Only change the attribute on its own, or you need to reset the form submission by default?
If the first option is exactly what you need, you already suggested.
If the second option then
buttonHeader.addEventListener('submit', function (evt) {
 evt.preventDefault() //preventDefault resets the default action 

Find more questions by tags JavaScript