Trigger Click Events with jQuery

Tell us what’s happening:
In this section, we’ll learn how to get data from APIs. APIs - or Application Programming Interfaces - are tools that computers use to communicate with one another.

We’ll also learn how to update HTML with the data we get from these APIs using a technology called Ajax.

First, let’s review what the $(document).ready() function does. This function runs such that all of the code inside of it executes only once our page has finished loading.

So Let’s start by implementing a click event handler inside of our $(document).ready() function by adding this code:

$("#getMessage").on(“click”, function(){

After completing this, proceed to the next challenge where we will make our “Get Message” button change the text of the element with the class message.

Your code so far

  $(document).ready(function() {
    // Only change code below this line.
    // Only change code above this line.

<div class="container-fluid">
  <div class = "row text-center">
    <h2>Cat Photo Finder</h2>
  <div class = "row text-center">
    <div class = "col-xs-12 well message">
      The message will go here
  <div class = "row text-center">
    <div class = "col-xs-12">
      <button id = "getMessage" class = "btn btn-primary">
        Get Message

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36.

Link to the challenge:

You did not include a question when you clicked for help. Please let us know what you need help understanding.

You can simple call the click event on the button: