jQuery .valid() throws error
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.
精彩评论