Skip to main content

Bug Tracker

Side navigation

#3638 closed enhancement (duplicate)

Opened November 23, 2008 05:37PM UTC

Closed November 25, 2008 11:32AM UTC

Improve toggleClass

Reported by: soywiz Owned by: flesler
Priority: minor Milestone: 1.3
Component: unfiled Version: 1.2.6
Keywords: Cc: soywiz
Blocked by: Blocking:
Description

toggleClass: function( classNames, set ) {

if (set === undefined) set = jQuery.className.has( this, classNames );

jQuery.className[ set ? "add" : "remove" ]( this, classNames );

}

It will allow to do something like this, while mantaining the original behaviour:

$('#id').toggleClass('enabled', (var > 0));

Attachments (0)
Change History (1)

Changed November 25, 2008 11:32AM UTC by flesler comment:1

cc: → soywiz
resolution: → duplicate
status: newclosed

Duplicate of #1681.