Search code examples
htmlcssloading-animation

Loading animation not working


I am following this tutorial: https://blog.oio.de/2010/11/08/how-to-create-a-loading-animation-spinner-using-jquery/ I made the loader as a gif but when I click on a link the loader is not working. I used the second part of loader where it can be added to a link.

Here is a link to the jsfiddle containing a part of my code: http://jsfiddle.net/rohitbegani/DcV8C/

$(document).ready(function(){
$('#button-upload').click(function() {
$('#spinner').show();
});
});

Main javascript used for getting on-click animation.

Can't actually load the gif file on fiddle as I don't know how to add external images/gif to a jsfiddle code(if it is at all possible)


Solution

  • You need to remove the # and replace with a period as it's a class for the button-upload.

    $(document).ready(function(){
        $('.button-upload').click(function() {
            $('#spinner').show();
        });
    });