Bug Tracker

Opened 12 years ago

Closed 12 years ago

#3638 closed enhancement (duplicate)

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

Change History (1)

comment:1 Changed 12 years ago by flesler

Cc: soywiz added
Resolution: duplicate
Status: newclosed

Duplicate of #1681.

Note: See TracTickets for help on using tickets.