Lord Eww Lel Lord Eww Lel - 7 days ago 5
CSS Question

jQuery to Remove Class Surrounding HTML Elements Not Working

I have a

<div>
with a class of
fouc
that surrounds most of my main HTML elements. I have set this to
display: none
and would like to remove it as soon as the page finishes loading. However, this is not working as expected. Thank you for your help.

CSS:

.fouc {
display: none;
}


JS:

$(window).on('load', function () {

$('body').removeClass('fouc');

});

shi shi
Answer

Try the following snippet

$(window).on('load', function () {

    $('.fouc').show();

});

Hope it helps

Comments