I have a couple of jQuery statements that should be invoked when an event occurs
document.addEventListener("DOMContentLoaded", function() {
$("#select_update").on("change", ()=> {
if ( $("#select_update option").eq(1).attr('class') !== 'default1' ) {
$("#select_update option").eq(1).toggleClass('default2 default1');
$("#which_default").empty().removeClass('default2');
}
});
when the event fires and the condition is true the last statement gets not executed while inserting the code into the console of the browser the statements get executed correctly why so?