开发者

Jquery finding firrt element of specific class

开发者 https://www.devze.com 2023-01-03 09:57 出处:网络
I am using jquery to find a first element having a class \"error\" applied to it using the below code

I am using jquery to find a first element having a class "error" applied to it using the below code

$('#mainDiv input.error:eq(0)')

But the above one working only for input elements only. How to make this on开发者_Python百科e to work for both input and select elements?


$('#mainDiv .error:eq(0)')

or

$('input.error, select.error', '#mainDiv').first()

if you want to find only input and select objects

0

精彩评论

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