开发者

jQuery .valid() throws error

开发者 https://www.devze.com 2023-04-05 09:28 出处:网络
In my JavaScript function sometimes $(args._postBackElement).valid() throws error because it is not a valid input element. Is there any way to check whether .valid() can be called for开发者_StackOverf

In my JavaScript function sometimes $(args._postBackElement).valid() throws error because it is not a valid input element. Is there any way to check whether .valid() can be called for开发者_StackOverflow社区 that element?


You could do -

$(args._postBackElement).length 

to see if the element existed, or -

$(args._postBackElement).is(":input")

to see if it's an input element.

0

精彩评论

暂无评论...
验证码 换一张
取 消