Change Text Inside an Element Using jQuery: Please explain not changing the text within the <em> tags

Change Text Inside an Element Using jQuery: Please explain not changing the text within the <em> tags
0

#1

Tell us what’s happening:
I finally found the answer with the hint. However, the wording of the explanation is a bit confusing. It says to add html tags to emphasize the text. I think it would be more helpful to word it a bit more elaborately in the explanation. For example, “Use the #target4 selector to change the button using “#target4” within the tags to emphasize the text, while allowing the text to remain unchanged.” I found the explanation confusing. I still don’t understand what “#target4” between the tags does. I know that it leaves the text the same for that button, but I wouldn’t have known that if I didn’t go to the “Get a Hint” to find the answer. Even in the answer, the explanation is not clear. I would like to know more about this concept so that I can use it with other coding needs in the future. I didn’t see any more definition in w3schools.com for that detail, either. Some more insight would be great. Thank you.
-AudreyLin
Your code so far

<script>
  $(document).ready(function() {
    $("#target1").css("color", "red");
    $("#target4").html("<em>#target4</em>");
    
  });
</script>

<!-- Only change code above this line. -->

<div class="container-fluid">
  <h3 class="text-primary text-center">jQuery Playground</h3>
  <div class="row">
    <div class="col-xs-6">
      <h4>#left-well</h4>
      <div class="well" id="left-well">
        <button class="btn btn-default target" id="target1">#target1</button>
        <button class="btn btn-default target" id="target2">#target2</button>
        <button class="btn btn-default target" id="target3">#target3</button>
      </div>
    </div>
    <div class="col-xs-6">
      <h4>#right-well</h4>
      <div class="well" id="right-well">
        <button class="btn btn-default target" id="target4">#target4</button>
        <button class="btn btn-default target" id="target5">#target5</button>
        <button class="btn btn-default target" id="target6">#target6</button>
      </div>
    </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/61.0.3163.100 Safari/537.36.

Link to the challenge:


#2

The #target4 between the em tags is just the text you want to emphasize. It could be anything. For example, you could have:

$("#target4").html("<em>I am emphasizing this text inside the target4 div using em tags</em>");

#3

So, for that exercise,"#target4" was basically just the placeholder to identify the text. Thank you. They may want to make the instructions/tutorial more clear for that exercise. Thank you for your help.