You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
536 B
24 lines
536 B
( function ( $, rwmb ) {
|
|
'use strict';
|
|
|
|
function toggleAll( e ) {
|
|
e.preventDefault();
|
|
|
|
var $this = $( this ),
|
|
$select = $this.parent().siblings( 'select' );
|
|
|
|
if ( 'none' === $this.data( 'type' ) ) {
|
|
$select.val( [] ).trigger( 'change' );
|
|
return;
|
|
}
|
|
var selected = [];
|
|
$select.find( 'option' ).each( function ( index, option ) {
|
|
selected.push( option.value );
|
|
} );
|
|
$select.val( selected ).trigger( 'change' );
|
|
};
|
|
|
|
rwmb.$document
|
|
.on( 'click', '.rwmb-select-all-none a', toggleAll );
|
|
} )( jQuery, rwmb );
|