Same element with multiple jQuery Selectors

Same element with multiple jQuery Selectors
0.0 0

#1

Use the $(“button”) selector.
Use the $(".btn") selector.
Use the $("#target1") selector.
Only add one class with each of your three selectors.
Your #target1 element should have the classes animated‚ shake and btn-primary.
Only use jQuery to add these classes to the element.
THIS IS THE CODE:

<script>
  $(document).ready(function() {
  $("button").addClass("");
  $(".btn").addClass("");
  $("#target1").addClass("animated shake btn-primary");
  });
</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>

#2

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

I am not sure what the point of this thread is, are you having a problem or something with the challenge, or are you just posting a solution? It looks like you are just posting a solution, so I am going to put your code in a spoiler. If you have a question, please tell us what the problem is.


#3

I’m pretty sure I remember that exercise. It was worded confusingly. It made it sound like you could only apply changes to one id, but had to use a selector for element, class, and id in the process. I’m betting that is where @BachAmadou got stuck based upon their code, assuming they got stuck.