}
// Create toggle link with a space around the brackets ( [text] )
- var $toggleLink = $( '<a href="#">' ).text( collapsetext ).wrap( '<span class="mw-collapsible-toggle mw-collapsible-toggle-expanded">' ).parent().prepend( ' [' ).append( '] ' ).click( function(e){
+ var $toggleLink = $( '<a href="#">' ).text( collapsetext ).wrap( '<span class="mw-collapsible-toggle mw-collapsible-toggle-expanded">' ).parent().prepend( ' [' ).append( '] ' ).bind( 'click.mw-collapse', function(e){
e.preventDefault();
toggleFunction( this );
} );
if ( !$toggle.size() ) {
$lastCell.prepend( $toggleLink );
} else {
- $toggleLink = $toggle.unbind( 'click' ).click( function( e ){
+ $toggleLink = $toggle.unbind( 'click.mw-collapse' ).bind( 'click.mw-collapse', function( e ){
e.preventDefault();
toggleFunction( this );
} );
}
$that.prepend( $toggleLink.wrap( '<li class="mw-collapsibile-toggle-li">' ).parent() );
} else {
- $toggleLink = $toggle.unbind( 'click' ).click( function( e ){
+ $toggleLink = $toggle.unbind( 'click.mw-collapse' ).bind( 'click.mw-collapse', function( e ){
e.preventDefault();
toggleFunction( this );
} );
if ( !$toggle.size() ) {
$that.prepend( $toggleLink );
} else {
- $toggleLink = $toggle.unbind( 'click' ).click( function( e ){
+ $toggleLink = $toggle.unbind( 'click.mw-collapse' ).bind( 'click.mw-collapse', function( e ){
e.preventDefault();
toggleFunction( this );
} );