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
640 B
24 lines
640 B
2 years ago
|
/**
|
||
|
* Disallow duplicate books in the featured books list.
|
||
|
*/
|
||
|
window.addEventListener( 'load', function () {
|
||
|
const selects = document.querySelectorAll( '#sub-accordion-section-pb_front_page_catalog select' );
|
||
|
/**
|
||
|
*
|
||
|
* @param current
|
||
|
* @param value
|
||
|
*/
|
||
|
let checkOtherValues = function ( current, value ) {
|
||
|
selects.forEach( function ( select ) {
|
||
|
if ( current.id !== select.id && select.value === value ) {
|
||
|
select.selectedIndex = -1;
|
||
|
}
|
||
|
} );
|
||
|
};
|
||
|
selects.forEach( function ( select ) {
|
||
|
select.addEventListener( 'change', function ( event ) {
|
||
|
checkOtherValues( event.target, event.target.value );
|
||
|
} );
|
||
|
} );
|
||
|
} );
|