freeCodeCamp/guide/english/miscellaneous/change-text-with-click-events/index.md

8 lines
371 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Change Text with Click Events
---
When a click event happens, we can use Ajax to update an HTML element with the following code:
$(".message").html("Here is the message");
This tells jQuery to use the class `message` as the selector and to that, change the HTML to have the string provide, we can also add custom html elements wrapped in quotation marks.