Lonwabo Mnyaiza
Lonwabo Mnyaiza

Reputation: 61

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'

Upvotes: 6

Views: 35017

Answers (3)

subash pandey
subash pandey

Reputation: 63

data-target attributes use data-target="_blank" below full code

" data-target="_blank"> source code

Upvotes: 0

Akshay Vijay Jain
Akshay Vijay Jain

Reputation: 15935

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

Upvotes: 1

HardScale
HardScale

Reputation: 1021

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.

Upvotes: 3

Related Questions