开发者

Select only visible text fields in jQuery

开发者 https://www.devze.com 2022-12-27 12:55 出处:网络
Is there a nicer way in jQuery to do this ? $(\":text\").each(function() { if (this.style.visibility == \"visible\") {

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

精彩评论

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