Why we use class target in button element

I am on challenge 91 and i dont understand why we have use class target in button element
<button class="btn btn-default target"></button>

edit:i am referring to "Create a Class to Target with jQuery Selectors” lesson in the Bootstrap section of Front End Development

I wonder what challenge 91 is? You should be more clear in what you ask.
This could be linked to either some CSS rule or some Javascript function.

I think you’re referring to the “Create a Class to Target with jQuery Selectors” lesson in the Bootstrap section of Front End Development, correct?

Not every class needs to have corresponding CSS. Sometimes we create classes just for the purpose of selecting these elements more easily using jQuery.
Give each of your button elements the class target.

I assumed that this target class would be used later in the jQuery section, but I couldn’t find where the target class was being used, only target# id’s. I’m curious about this too.

I cannot say for sure, but often a class is assigned to some element - in this case a button - to hook it into a framework, a plugin, or some other library of code. In this specific case the class btn and btn-default look like Bootstrap, so maybe it is hooking the button to that.

Sorry, misread your question - just took a closer look and @jeremybbauer is correct - the Target class is simply being used to demonstrate that a class selector can be used as a target for JavaScript, JQuery and other bits of coding, not just CSS.

1 Like

I think the link for this problem is:

jQuery: Target a Specific Child of an Element Using jQuery

So the reason this tag has the target class is that, we can use jQuery to select and add class to its children tag.

Hi @davidluoyes!

Welcome to the forum!

Thank you for your response however this thread is over three years old. Please try to respond to newer topics.