Change value of input and submit form in JavaScript

前端 未结 8 1439
死守一世寂寞
死守一世寂寞 2020-11-30 03:20

I\'m currently working on a basic form. When you hit the submit button, it should first change the value of a field, and then submit the form as usual. It all looks a bit li

8条回答
  •  执笔经年
    2020-11-30 03:36

    document.getElementById("myform").submit();
    

    This won't work as your form tag doesn't have an id.

    Change it like this and it should work:

提交回复
热议问题