Bug Tracker

Modify

Ticket #3638 (closed enhancement: duplicate)

Opened 5 years ago

Last modified 5 years ago

Improve toggleClass

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

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

comment:1 Changed 5 years ago by flesler

  • Cc soywiz added
  • Status changed from new to closed
  • Resolution set to duplicate

Duplicate of #1681.

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.