Message from JavaScript discussions

November 2020

— No visible result, putting it either before or after the addClass line.

— 

Tried toggleClass in place of addClass, but still no effect and no error.

The same line of code in another file works fine, so I'm quite at loss.

— Now I changed it to "header" in place of "body" and it works, but I need it on body, how come that one gets ignored?

Message permanent page

— JQuery(document).ready(function () {

jQuery(document).ready(function () {

if(jQuery("#block-darkbgcontrol .dark-bg-control").hasClass("dark-bg") === true) {
jQuery("body").toggleClass("element-dark");
}

});

});

This works. Is it bad practice to repeat jQuery(document).ready() ?

Message permanent page

— 😅

— Stop saying.. words lol

— Remove the === true

— I think i got it, misan statement started a code philosophy party

— Same, doesn't work, unless I repeat the document ready.

— Ye, the responsibility to enforce the law and make peon obey the rules

— Did you put your code in the head or in the body?

— Stomping on reviewee neck