Home > database >  All my functions get ignored, except the last one
All my functions get ignored, except the last one

Time:11-29

I don't know how to get the other functions (on the top) to run, it only works with the last one.

My code:

function advance(rQ, desc, ec){
            $('.achieve').text(desc   ". "   'Points: '   ec);
            $('.achieve').append(desc   ". "   'Points: '   ec);
            $('.achieve').append(desc   ". "   'Points: '   ec);
        }

        advance(5, "Getting Started. Get 5 points", 1);
       advance(10, "No Longer a Rookie. Get 10 points", 1);
       advance(15, "More Than a Beginner. Get 15 points", 1);
       advance(20, "Getting The Hang of It! Get 20 points", 1);
       advance(30, "Beating the Average. Get 30 points", 2);
       advance(45, "More Than a Master. Get 45 points", 2);
       advance(50, "OG. Get 50 points", 1);
       advance(60, "Hacker. Get 60 points", 2);
       advance(90, "King of Twurkeys. Get 90 points", 3);
       advance(100, "Pro Hacker. Get 100 points", 2);

You can see, I was duplicating the append() function. I also did it to the text() function to.

Here's my site: https://venerable-dango-3de1ef.netlify.app/achieve.html.

Thanks

CodePudding user response:

Delete the text. The text was overwriting the previous functions, only showing the last function. To fix that, just simply delete the text().

  • Related