$td = $( '<td>' ),
$fieldLabelText = $( '<label>' ),
$container;
- if ( type === 'table' ) {
+ if ( type === 'tr' ) {
addMulti( $oldContainer, $td );
$container = $( '<tr>' );
$container.append( $td );
if ( $( '.mw-chosen' ).length ) {
mw.loader.using( 'jquery.chosen', function () {
- var $toConvert,
- $converted;
- $toConvert = $( 'table .mw-chosen' );
- if ( $toConvert.length ) {
- $converted = convertCheckboxesToMulti( $toConvert, 'table' );
+ $( '.mw-chosen' ).each( function () {
+ var type = this.nodeName.toLowerCase(),
+ $converted = convertCheckboxesToMulti( $( this ), type );
$converted.find( '.htmlform-chzn-select' ).chosen( { width: 'auto' } );
- }
- $toConvert = $( 'div .mw-chosen' );
- if ( $toConvert.length ) {
- $converted = convertCheckboxesToMulti( $toConvert, 'div' );
- $converted.find( '.htmlform-chzn-select' ).chosen( { width: 'auto' } );
- }
+ } );
} );
}