Skip to main content

Bug Tracker

Side navigation

#11964 closed bug (worksforme)

Opened June 23, 2012 11:21PM UTC

Closed June 23, 2012 11:45PM UTC

hasClass removeClass bug

Reported by: Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Theres a bug which prevents hasClass and removeClass from being used in one logic statement:

var $galleryImg = $('.galleryImgs').hasClass('hidden').removeClass('hidden').closest('.galleryImgs').nextAll('.galleryImgs').eq(0).addClass('hidden').attr("data-src");

Had to use this:

var $galleryImg = $('.galleryImgs.hidden').removeClass('hidden').closest('.galleryImgs').nextAll('.galleryImgs').eq(0).addClass('hidden').attr("data-src");

Attachments (0)
Change History (1)

Changed June 23, 2012 11:45PM UTC by rwaldron comment:1

resolution: → worksforme
status: newclosed

You've misunderstood how hasClass works, when to use it and why. The second is correct. Please use the forum for support questions.