Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap data-toggle , data-target & href attributes

In bootstrap when I use the data-toggle & data-target attributes my href seems not to work does anyone know a way around this echo'Change'

like image 545
Lonwabo Mnyaiza Avatar asked Sep 14 '14 11:09

Lonwabo Mnyaiza


2 Answers

When data-target="link" and data-toggle="class" are set, bootstrap.js uses them to override the default href attribute. Setting the href to a static link will give a noscript browser something to go to.

The standard HTML markup for an anchor tag is:

<a href="link.html">LINK</a>

which is what a noscript browser will see, because it will ignore the data-* values.

like image 124
HardScale Avatar answered Nov 09 '22 13:11

HardScale


For me there was no issue.

<div class="panel">
  <a href="http://www.google.com" data-parent="#panel" data-toggle="collapse" data-target="#aa">Collapse</a>
  <div id="aa" class="collapse in">aaaaaaaaaaaaaaaaaaaggggggggg hhhhhhhhhh iii ii jjjjjjj kkkkkkk lllllllllll lllllllll mmmmmm mmmm ooooop</div>
</div>

Here my anchor tag takes me to google.com after collapsing the #aa

like image 42
Akshay Vijay Jain Avatar answered Nov 09 '22 14:11

Akshay Vijay Jain