Puru Vijay Puru Vijay - 4 months ago 23
jQuery Question

jquery - removing loading div after the page has loaded

So I created a simple method to put a loader. I put a loader already and put the opacity of a main container tag to 0.4 . but when page loads, my javascript doesn't remove the loader and set opacity to 1. So my code here:

Important Notes:

I use JQuery version 2(I don't know the exact)

$(document).ready(function() {
$(this).load(function() {
$('body').css("opacity", "1");


You should use $(window).load() not $(document).load()

    alert("This can run");
    alert("This cannot run");
    alert("This cannot run too");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>