简体   繁体   中英

Can I take the submit button out of the form builder somehow?

I'm using form_for to make a form. However, I want the submit button <%= f.submit "Submit" %> to be inside another element that's not inside the form. I can't just put the element inside the form -- it's separated by too much html. Is there a way to take this submit button out and put it in another div or just use plain html to submit the form?

如果您可以选择使用Javascript,则只需在表单外部创建一个按钮,然后将其onClick与类似

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM