Force a checkbox to always submit, even when unchecked

后端 未结 7 1344
粉色の甜心
粉色の甜心 2020-12-01 23:36

I have an html form and i would like ALWAYS to have checkboxes to submit a value. How can i do that? I have one idea but i havent tried it and i am unsure if its the best wa

相关标签:
7条回答
  • 2020-12-02 00:30

    if you have many checkbox, you can try this code:

    <input type="checkbox" onclick="$(this).next().val(this.checked?1:0)"/> <input type="hidden" name="checkbox1[]"/>
    
    0 讨论(0)
提交回复
热议问题