开发者

Select only visible text fields in jQuery

Is there a nicer way in jQuery to do this ?

$(":text").each(function() {
   if (this.style.visibility == "visible") {
     开发者_如何学Python ...
   };
});


yes:

$(":text:visible").each(function() {
   ...
});

UPDATE Since jQuery this doesn't work anymore: details.


You're looking for the :visible selector:

$(':text:visible')


For speed use

$(':text').filter(":visible")
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜