jQuery验证未捕获的TypeError:无法调用未定义的方法"getAttribute" [英] jQuery Validate Uncaught TypeError: Cannot call method 'getAttribute' of undefined

查看:143
本文介绍了jQuery验证未捕获的TypeError:无法调用未定义的方法"getAttribute"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用jQuery validate给出此HTML

Given this HTML using jQuery validate

 <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>

我收到此错误:

未捕获的TypeError:无法调用未定义的方法'getAttribute'

Uncaught TypeError: Cannot call method 'getAttribute' of undefined

推荐答案

缺少名称"属性:

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

(这花了我一段时间才能弄清楚,所以我认为我会分享问题和解决方案)

(This took me a while to figure out so I thought I'd share the question and solution)

也:请检查以下评论,因为其他人也发布了导致同一异常的其他原因.

Also: Check the comments below, as others have posted other causes for the same exception.

这篇关于jQuery验证未捕获的TypeError:无法调用未定义的方法"getAttribute"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆