Wednesday, May 29, 2024
 Popular · Latest · Hot · Upcoming
25
rated 0 times [  28] [ 3]  / answers: 1 / hits: 26116  / 9 Years ago, sun, december 6, 2015, 12:00:00

I fail to understand why href is not working on a tag for data-toggle=dropdown . When I hit the Lists tab, i should be routed to the google website.



FIDDLE HERE



Simple HTML:



<div class=btn-group>
<a href=http://google.com class=btn btn-default dropdown-toggle data-toggle=dropdown>Lists</a>

<ul class=dropdown-menu role=menu>
<li>
<a href=#>Sub List 1</a>
</li>
<li>
<a href=#>Sub List 2</a>
</li>
</ul>
</div>

More From » html

 Answers
2

From Bootstrap documentation (http://getbootstrap.com/javascript/#dropdowns):




To keep URLs intact with link buttons, use the data-target attribute
instead of href=#.




So your code should be



 <a data-target=http://www.google.es  target=_blank href=http://www.google.es class=btn btn-default dropdown-toggle>Lists</a>

<ul class=dropdown-menu role=menu>
<li>
<a href=#>Sub List 1</a>
</li>
<li>
<a href=#>Sub List 2</a>
</li>
</ul>




Futhermore, you can find more information about how to get menu dropdown using hover instead of click: How to make twitter bootstrap menu dropdown on hover rather than click


[#64150] Thursday, December 3, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dylan

Total Points: 734
Total Questions: 91
Total Answers: 102

Location: Philippines
Member since Sat, Jul 11, 2020
4 Years ago
dylan questions
Thu, Feb 10, 22, 00:00, 2 Years ago
Wed, Nov 24, 21, 00:00, 3 Years ago
Fri, Apr 3, 20, 00:00, 4 Years ago
Mon, Mar 9, 20, 00:00, 4 Years ago
;