Explain me how do you use the Dropdown plugin?

Submitted by: Muhammad
You can toggle the dropdown plugin's hidden content −

☛ Via data attributes − Add data-toggle = "dropdown" to a link or button to toggle a dropdown as shown below −

<div class = "dropdown">
<a data-toggle = "dropdown" href = "#">Dropdown trigger</a>
<ul class = "dropdown-menu" role = "menu" aria-labelledby = "dLabel">
...
</ul>
</div>

☛ If you need to keep links intact (which is useful if the browser is not enabling JavaScript), use the data-target attribute instead of href="#" −

<div class = "dropdown">
<a id = "dLabel" role = "button" data-toggle = "dropdown" data-target = "#" href = "/page.html">
Dropdown

<span class = "caret"></span>
</a>

<ul class = "dropdown-menu" role = "menu" aria-labelledby = "dLabel">
...
</ul>

</div>

☛ Via JavaScript − To call the dropdown toggle via JavaScript, use the following method −

$('.dropdown-toggle').dropdown()
Submitted by: Muhammad

Read Online Bootstrap Job Interview Questions And Answers