Disappearing Act: Help Please!

I have no idea what is wrong with this level. Every time I run it, it says, “This error was generated by old code-Try running new code first”. Can anyone pls help me? Here is my code:

<!-- JavaScript can be used to show and hide elements! -->
<script>
    let showButton = $("#showButton");
    // Create the variable 'hideButton' to store #hideButton
    let hideButton = $("#showButton");
    let image = $("#image");
    function showElement() {
        image.show();
    }
    function hideElement() {
        // Use the "hide()" function on the image variable:
        image.hide();
    }
    showButton.on("click", showElement);
    // Add an event listener to the hideButton variable.
    // It should perform hideElement when a "click" occurs:
    hideButton.on(“click”, hideButton);
</script>
<style>
    body {
        text-align:center;
    }
    button {
        width:25%;
        height:64px;
    }
    img {
       width:50%; 
    }
</style>
<button id="showButton">Show</button>
<button id="hideButton">Hide</button>
<br>
<img id="image" src="http://direct.codecombat.com/file/db/thang.type/57586f0a22179b2800efda37/portrait.png"/>

try changing let to var and in this part

    // Add an event listener to the hideButton variable.
    // It should perform hideElement when a "click" occurs:
    hideButton.on(“click”, hideButton);

the quotes in the click are messed up

also your variable hideButton is showButton

    // Create the variable 'hideButton' to store #hideButton
    let hideButton = $("#showButton");

Yeah. I got it now. Thanks for the help!

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.