mw.hook( 'wikipage.content' ).add( function( $content ) { $content.find( '.ambox' ).click( function( e ) { $( this ).toggleClass( 'mbox-expand' ); } ); } );