freeCodeCamp Challenge Guide: Give Each Element a Unique ID

freeCodeCamp Challenge Guide: Give Each Element a Unique ID
0.0 0

#1

We will also want to be able to use jQuery to target each button by its unique id. So we add an unique id to each button.


#2

this question is a little old but i’m the code should look like this

<button id=“target1” class=“btn btn-default target”>



#3

I did as mentioned above and its not running. I tried running it with id in the front also but nothing, what am I doing wrong?

  <div class="well" id="left-well">
    <button id="Target1" class="btn btn-default target" ></button>
    <button id="Target2" class="btn btn-default target" ></button>
    <button id="Target3" class="btn btn-default target" ></button>
  </div>
</div>
<div class="col-xs-6">
  <h4>#right-well</h4>
  <div class="well" id="right-well">
    <button id="Target4" class="btn btn-default target" ></button>
    <button id="Target5" class="btn btn-default target"></button>
    <button id="Target6" class="btn btn-default target" ></button>
  </div>
</div>

#4

You should use id=“target1” AFTER target (think about it)

E.g
button class=“btn btn-default target” id=“target1”></button


#5

tried it, still not working


#6

this is spoiler !!!

<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"></button>
        <button class="btn btn-default target" id="target2"></button>
        <button class="btn btn-default target" id="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"></button>
        <button class="btn btn-default target" id="target5"></button>
        <button class="btn btn-default target" id="target6"></button>
      </div>
    </div>
  </div>
</div>