Opened 14 years ago
Closed 14 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 14 years ago by
Cc: | soywiz added |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
Duplicate of #1681.