【问题标题】:Submit button not working with checkboxes提交按钮不适用于复选框
【发布时间】:2019-06-17 16:18:30
【问题描述】:

我正在为这家公司建立一个网站,他们必须通过这个来进行交付,由于某种原因我的提交按钮不起作用,对不起,我是新人。

我粘贴的代码在 2 个不同的部分,脚本在顶部,而 div 类在正文部分。

尝试在网上搜索,但似乎找不到解决方案。

</script>
<div class="4u12u$(large)">
<input type="checkbox" id="hygiene" name="hygiene"><label for="hygiene">Hygiene</label>
<input type="checkbox" id="safety" name="safety"><label for="safety">Safety</label>
<input type="checkbox" id="pan" name="pan"><label for="pan">Pan/Wheel Chuck</label>
</div> 

我想做一些类似“在继续之前检查所有这些”的事情。

【问题讨论】:

标签: javascript php html css


【解决方案1】:

您缺少基础知识,我选择在此处获取表单,因为它适用于 url

<form action="#" method="get">
    <input type="checkbox" name="test" value="1">
    <input type="checkbox" name="test" value="2">
    <input type="checkbox" name="test" value="3" checked="checked">
    <input type="submit" value="submit">
</form>

您可以在https://www.w3schools.com/ 上了解 html(和其他语言),他们有一些很好的资源可供开始。

【讨论】:

    【解决方案2】:

    试试这个方法

    <div class="4u12u$(large)">
    <form action="your url" method="post">
     <input type="checkbox" id="hygiene" name="hygiene" required><label for="hygiene">Hygiene</label>
     <input type="checkbox" id="safety" name="safety" required><label for="safety">Safety</label>
     <input type="checkbox" id="pan" name="pan" required><label for="pan">Pan/Wheel Chuck</label>
    </form>    
    </div> 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-13
      • 2017-08-18
      • 2018-07-28
      • 2017-04-09
      相关资源
      最近更新 更多