Target Element in jQuery(What is .target?)

Tell us what’s happening:
I can follow the instructions and run the code successfully, but i don’t understand what does “.target” here mean?
.target:nth-child(n),
.target:odd
I looked an document and understood nth-child(n), but where does the .target: come from? What does it mean? Are they supposed to always be used together?

Your code so far

<script>
  $(document).ready(function() {
    $("#target1").css("color", "red");
    $("#target1").prop("disabled", true);
    $("#target4").remove();
    $("#target2").appendTo("#right-well");
    $("#target5").clone().appendTo("#left-well");
    $("#target1").parent().css("background-color", "red");
    $("#right-well").children().css("color", "orange");
    $("#left-well").children().css("color", "green");
    $(".target:nth-child(2)").addClass("animated bounce");

  });
</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 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/target-even-numbered-elements-using-jquery

target is just the class name :smile:

<button class="btn btn-default target" id="target1">#target1</button>

The buttons have the classes btn, btn-default, target; the first two classes are BootStrap stuff, the last is a custom class ( you could rename it layer, sedct123, bottle, etc…)

So, in the .target the most interesting part is not ‘target’, but ’ . ’ : this is how you select classes in JQuery (or css). If you want to select Ids you would use # instead of . (as you can see in the code you’re working on)

Sometimes things are simpler than they appear :grin: