How do I submit a form with a
  • instead of a submit button?
  • 前端 未结 6 843
    抹茶落季
    抹茶落季 2021-01-18 10:42

    I want to be able to submit a form but instead of having to click on a submit button, I\'d like to be able to click on an

  • element and have it submit.
  • 6条回答
    •  梦谈多话
      2021-01-18 11:30

      JavaScript.

      Wire the onclick event of the element. Get a reference to the form.

      var frm = document.getElementById('formid');
      

      Submit it.

      frm.submit()
      

    提交回复
    热议问题