Explain me how do you use the Dropdown plugin?
Submitted by: MuhammadYou 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
☛ 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
Top Bootstrap Questions
☺ | Do you know what is Bootstrap well? |
☺ | Do you know what is Bootstrap Jumbotron? |
☺ | What is Fluid Layout in Bootstrap? |
☺ | What is button group in Bootstrap? |
☺ | Tell me what is Bootstrap collapsing elements? |
Top Web Developer Categories
☺ | Bootstrap Interview Questions. |
☺ | Front End Web Developer Interview Questions. |
☺ | Typography Interview Questions. |
☺ | Laravel PHP Developer Interview Questions. |
☺ | Junior Developer PHP Interview Questions. |