Welcome to the Treehouse Community
Looking to learn something new?
I'm unsure about the Bootstrap data-toggle and data-target attributes
I can't find good documentation regarding the data-toggle and data-target attributes. From my findings, I'm GUESSING that data-toggle is a class of some sort for a particular element. For example data-toggle="modal" data-target="#myModal" - this will trigger a modal with the ID of "myModal".
However, I found a few more:
data-toggle="modal" data-toggle="collapse" data-toggle="dropdown" data-toggle="tab"
I'm, again, guessing, that theses different values for the attributes are for different types of elements. For example, "collapse" might be used for a navigation menu? Is that correct?
Wilson Usman35,206 Points
It helped me understand it a lot better. You're on the right track though.
Take a look at this sample code for better understanding.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> <div class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown trigger</a> <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> <li><a href="#">Item</a></li> </ul> </div>