Target Element in jQuery(What is .target?)

Target Element in jQuery(What is .target?)
0.0 0


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?
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

  $(document).ready(function() {
    $("#target1").css("color", "red");
    $("#target1").prop("disabled", true);
    $("#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");


<!-- 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">
      <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 class="col-xs-6">
      <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>

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:


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: