如果选中复选框,则取消选择输入类型

时间:2017-08-15 13:06:43

标签: html css validation checkbox required

我有一个几乎所有输入类型都需要的表单,如下面的HTML:

                <p>Name:*</p>
                  <input type="text" name="Name" required>
                <p>Company Name: </p>
                    <input type="text" name="Company_Name">
                <p>Email: *</p>
                    <input type="email" size="30" name="Email" required>
                <p>Phone:*</p>
                    <input type="text" name="Phone" required>

在表单的最后,我有一个复选框,指出

                    <div class="checkbox">
                       <input type="checkbox"  name="checkbox_name[]" > 
                         <p>I'm Going</p>   
                       <input type="checkbox"  name="checkbox_name[]" >
                         <p>thanks, but I can't go</p>  

                      <input type="checkbox" name="checkbox_name[]" required>                 
                      <p>I have read the above information</p>

有没有办法可以解决&#34; de-required&#34;以上输入类型当且仅当&#34;谢谢,但我不能去&#34;复选框已标记?

1 个答案:

答案 0 :(得分:0)

检查一下。它根据我要去的复选框更改`required属性。 您可以根据需要进行修改。我希望你有这个想法。

'a'