jQuery 验证未捕获类型错误:无法调用未定义的方法“getAttribute”

2024-03-25

使用 jQuery 验证给定此 HTML

 <input id="accept-terms" type="checkbox" class="required"/> 
 <label for="accept-terms"> I accept the <asp:HyperLink ID="termsLink" runat="server" Target="_blank">terms and condtions</asp:HyperLink> of sale.</label>
 <label for="accept-terms" class="error-text">You must accept the terms and conditions before purchasing</label>

我收到此错误:

未捕获的类型错误:无法调用未定义的方法“getAttribute”


缺少“名称”属性:

<input id="accept-terms" name="accept-terms" type="checkbox" class="required"/> 

(这花了我一段时间才弄清楚,所以我想我应该分享问题和解决方案)

另外:检查下面的评论,因为其他人已经发布了同一异常的其他原因。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

jQuery 验证未捕获类型错误:无法调用未定义的方法“getAttribute” 的相关文章

随机推荐