Bug Tracker

Modify

Ticket #11964 (closed bug: worksforme)

Opened 11 months ago

Last modified 11 months ago

hasClass removeClass bug

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

Description

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");

Change History

comment:1 Changed 11 months ago by rwaldron

  • Status changed from new to closed
  • Resolution set to worksforme

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.