$('.开发者_高级运维fse:visible').each(function (i)
-> Unknown Pseudoclass or Pseudoelement 'visible'.
second try$('.fse').is(':visible').each(function (i)
-> $(".fse").is(":visible").each is not a function
Whats wrong?
Thanks in advance!
Peter$('.fse').is(':visible') checks if the element is visible or not and returns true or false. Appending ".each" is the same as you would typing "false.each(...)" or "true.each(...)". And "true" or "false" does not have a method called "each".
You can try it using the find-selector: $.find('.fse:visible').each(...) or jQuery.find('.fse.visible').
Though an old article i couldn't find the way i handle it as an solutions. And for me it works fine. So here it is:
$('.fse').filter(':visible').each( function () {
//do something here
});
Hope i could help you.
I don't think it is an Error but a CSS Warning you are getting and it is normal. Had the same trouble (even appears on the jquery.com website) some time back.
See the discussion here: http://old.nabble.com/Unknown-pseudo-class-or-pseudo-element-%27odd%27.-td25425663s27240.html
The first error is a bit mysterious, based on the information you have provided. The second makes perfect sense since .is(":visible")
returns a boolean, not a jQuery object.
It sounds like you also have Prototype (or another library using $
) included in the page, is that the case?
Try jQuery('.fse:visible').each(function (i) {...
to verify that's the case.
Since class can commonly defined u cant use as $(".classname : visible").each(function(i))
try this:
if($('.fse').is(':visible'))
{
//Do something here
$(this).css({'color':'red'});
}
精彩评论