jQuery click listener doesn't work properly

what did I do wrong?

please share the exercise url and code so we can run your code in the exercise

This is the old course, the environment is no longer supported.


i asked also for your code? The exercise url would just load my own code, but i needed it to find the exercise

The instructions show add HTML button with the id of change_me,
So your button tag may .
And also the selector in script.js at line 2 would be $("#change_me") instead of $("#button")

In selector, you should make sure id comes after #.

1 Like

here is my code:
in index.html doc:

<!DOCTYPE html>
		<link rel="stylesheet" href="style.css" />
		<script src='script.js' type="text/javascript"></script>
	<button id="button">Click Me!</button>
	<div id="change_me"></div>
#button {
    background-color: pink;
    color: white;
    width: 200px;
    height: 50px;


in script.js doc:

         alert("I have been changed!");


When it is clicked, change the .text() of change_me to “I have been changed!”

you need to use .text(), not alert()

1 Like