Change Text Inside an Element Using jQuery error

Tell us what’s happening:

Your code so far

<script>
  $(document).ready(function() {
    $("#target1").css("color", "red");
    $("target4").html("<em>jQuery Playground</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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/change-text-inside-an-element-using-jquery

@Love

You are supposed to target the element with the ID of target4.

i did but cant get result

Do you understand the difference between the following three jQuery selectors?

$("target4");

$(".target4");

$("#target4");

What is each attempting to select?

If you do not understand what these are selecting, then I suggest going back to review the previous jQuery challenges before trying to solve this current challenge.

no result still have 2errors

Were you able to answer my question above? If so, then I would like to hear your answer.

Also, since we do not know what you have tried since your original code, please reply with your latest code attempt.

To enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

markdown_Forums

Also, can you tell us what two errors you are seeing?

i have error on this code $(".target4").html(“jQuery Funhouse”); is not working and i followed instruction but didnt get answer

The above code has two issues which are causing you to fail the test.

  1. You still are not targeting the correct button with id target4. Since you can not or will not answer my previous question, I have to assume you do not understand the code you have written. Again, I suggest reviewing the previous jQuery challenge on how to select elements with a specific id.

  2. Per the instructions, you are supposed to emphasizing the button’s text. The challenge gives an example showing exactly how to to this. Of course the example is not using the same text that your button has, so you will have to change to reflect your button’s text. The button you are supposed to be targeting does not have the text “jQuery Playground”.

These two error i cant’ solve :-Emphasize the text in your target4 button by adding HTML tags,Make sure to select button id=“target4” with jQuery

Tell us what’s happening:
these two error i cant’ solve :-Emphasize the text in your target4 button by adding HTML tags,Make sure to select button id=“target4” with jQuery.

Your code so far

<script>
  $(document).ready(function() {
    $("#target1").css("color", "red");
    $(".target4").html("<em>jQuery Funhouse</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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36```.

**Link to the challenge:**
https://www.freecodecamp.org/challenges/change-text-inside-an-element-using-jquery

It seems you are targeting the class of target4, instead of the required id.

- $(".target4").html("<em>jQuery Funhouse</em>");
+ $("#target4").html("<em>jQuery Funhouse</em>");

I merged your other thread with this one. In the future, please do not create duplicate posts for the same question. We do not want duplicate threads because if someone provides you with an answer that you are satisfied in one thread, then another person still might provide the same answer in the other thread. We don’t want to waste others’ time if one answer will suffice.