Changing Text with Click Events

Changing Text with Click Events
0

#1

Tell us what’s happening:

I am lost with the $(".message"). portion, because the HTML code does not have a class of “message”.

Your code so far

<script>
  $(document).ready(function() {
    $("#getMessage").on("click", function(){
      // Only change code below this line.
      $(".message").html("Here is the message");
      // Only change code above this line.
    });
  });
</script>


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

Your browser information:

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

Link to the challenge:


#2
<div class = "col-xs-12 well message">

#3

The line below in the code shows the message class:

<div class = "col-xs-12 well message">

This div element has 3 different classes:

  1. col-xs-12
  2. well
  3. message

You can apply more than one class to an element by separating by spaces.