skip to Main Content

i made a simple html program (with JQuery) that makes it so that the page gets angrier and angrier every time. however, it seems to not work and i’ve checked every nook and cranny, searched through every line, with it still not working.

(forgive me for this bad explanation im still new to the site)

<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
    </head>
    <body>
        <button class="button"> dont press the button </button>
        <button class="button" style="display:none;"> another button </button>
        <p id="warning"> </p>
        
        <script>
            var clickCount = 0;
            $(".button").click(function(){
                clickCount += 1;
                console.log(clickCount);
                if (clickCount.value == 1) {
                    $("#warning").text("I said DONT PRESS!");
                }
                else if (clickCount.value == 2) {
                    $("#warning").text("Come on!");
                }
                else if (clickCount.value == 3) {
                    $("#warning").text("Your really getting on my nerves right now.");
                }
                else if (clickCount.value == 4) {
                    $("#warning").text("Is this all you do?");
                }
                else if (clickCount.value == 5) {
                    $("#warning").text("ALRIGHT, PLAYTIMES OVER! NO MORE BUTTON!");
                    $("#button").css({"display":"none"});
                }
                else if (clickCount.value == 6) {
                    $("#warning").text("Sigh...");
                    $("#button").css({"display":"block"});
                }
                else if (clickCount.value == 7) {
                    $("#warning").text("Alright then... how about this for a challenge?");
                    $("#button").css({"display":"block"});
                }
            })
        </script>
    </body>
</html>

for some reason, when I click the button the text doesnt show up. anyways im in a hurry so i cant explain much.

2

Answers


  1. Chosen as BEST ANSWER

    update: just realized I'm a huge idiot and i didn't need to put .value at all thanks for helping


  2. Why are you using clickCount.value in your if statements? Shouldn’t you just be checking clickCount.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search