Under standing .addClass

Tell us what’s happening:

Hello ive added .addClass(“animated bounce”) but still unsure what .addClass means? does it add a class like css? or what am i missing here?

Your code so far


<script>
$(document).ready(function() {
$("button").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:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36.

Challenge: Target HTML Elements with Selectors Using jQuery

Link to the challenge:

Hi @Eddy007, welcome to the freeCodeCamp forum!

It adds classes to the class property of the html elements:

Before:
image
After:
image

1 Like

Also, check the documentation. jQuery has pretty good docs.
https://api.jquery.com/addClass/

2 Likes

Adding to @lasjorg, If you have a problem with anything, try to refer to each respective Documentations first, because most of the times they are clear and understandable. Then when you start to get confused, you can try to ask other Coders about the topic. Just a friendly reminder!!

Stay Safe, and Happy Coding !!:slight_smile:

Catalactics

1 Like

I just leaned this property in javascript an hour ago.I made a new class in css, added properties and then call it in javascript by “style.classList.add=”";.I can just help this!

1 Like

Thank you for taking the time to clarify! i understand now thanks again!

thannk you for the info! No problem will do!