Codecademy

Sign In Create Account
01/04
Events

Events are an important part of JQuery programming. They allow us to create websites that respond to user actions. In the language of the technology, we bind events to elements. Then those events are triggered by an action from the user.

Usually we create events and triggers in a streamlined set of JQuery syntax. You have already seen this in earlier lessons where you used the $object.click() function. When you call click() JQuery creates an event and binds it to $object. That event is then set to be triggered whenever the object has the click action performed on it. Let's do it again to jog your memory.

Attach a click() function to the clickMe button. When the event is triggered you should change the html of the changeMe div to say "I have been changed". Make sure it says exactly that!

Stuck? Get a hint!Hint

Create the clickMe function using the code:
`$('#clickMe').click(function(){

});`

To change the html of changeMe you can use:
$("#changeMe").html("some text here");

Save & Submit Code Reset Code View Preview
Back to editor
Back to editor
FULL PREVIEW

Start Here

Each lesson starts here. Read the explanation, then follow the instructions underneath. If you get stuck, you can click on the "Hint" for help.

Enter your Code

Type your response to the instructions here, in your code editor.

See What it Does

Here's where you can see how your code will render in your browser. This will update as you type.

Submit!

Ready to see if your code does what it should? Click "Save + Submit" to check your code!

Click "Save + Submit" to run your code! Your code’s output will pop up on the screen.

Sign in to Codecademy