Submit an HTML form without having a submit button?

前端 未结 11 1363
攒了一身酷
攒了一身酷 2021-01-01 18:57

Can I submit a html

with
instead of ?

Like this:

         


        
11条回答
  •  清酒与你
    2021-01-01 19:42

    If you want to unnecessarily depend on JavaScript, then you could…

    jQuery('div').click(function () { jQuery('form').submit(); });
    

    … however, you should use semantic HTML that works without JS being present. So use a real submit button and apply CSS to make it look the way you want.

提交回复
热议问题