CARVIEW |
Select Language
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 11 Oct 2025 09:23:00 GMT
Content-Type: text/html
Last-Modified: Wed, 18 Sep 2024 14:30:33 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
ETag: W/"66eae409-23b5"
Reporting-Endpoints: csp-endpoint='https://csp-report-api.openjs-foundation.workers.dev/'
Content-Security-Policy: default-src 'self'; script-src 'self' 'wasm-unsafe-eval' code.jquery.com; connect-src 'self'; img-src 'self' secure.gravatar.com; style-src 'self'; media-src 'self' content.jquery.com; report-uri https://csp-report-api.openjs-foundation.workers.dev/; report-to csp-endpoint
Content-Encoding: gzip
#11964 (hasClass removeClass bug) - jQuery - Bug Tracker
jQuery issues have moved to GitHub. This site is now a static archive of the old Trac bugs site. Some functions and pages are no longer available.
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: | corey@coreyyoungcorp.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
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");
Attachments (0)
Change History (1)
Changed June 23, 2012 11:45PM UTC by rwaldron comment:1
resolution: | → worksforme |
---|---|
status: | new → closed |
You've misunderstood how
hasClass
works, when to use it and why. The second is correct. Please use the forum for support questions.