w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Jquery Not Executing, works fine on JSfiddle

Wrap your jQuery in a document ready call or put the JS at the end of the document. You're trying to execute it on elements that don't exist yet. jsFiddle defaults to adding your code inside a window.load call (see the options in the upper left corner of jsFiddle).


    var fadeinBox = $("#box2");
    var fadeoutBox = $("#box1");
    function fade() {
        fadeinBox.stop(true, true).fadeIn(2000);
        fadeoutBox.stop(true, true).fadeOut(2000, function() {
            var temp = fadeinBox;
            fadeinBox = fadeoutBox;
            fadeoutBox = temp;
            setTimeout(fade, 1000);

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.