VB_
VB_

Reputation: 45692

Bootstrap modal: disable opening in new tab/window

I've got something like this.

Question: How to disable opening Home and Profile tabs in new window?

Upvotes: 0

Views: 2545

Answers (3)

VB_
VB_

Reputation: 45692

The solution is very simple: add oncontextmenu="return false;" to the ul element.

<ul class="nav nav-tabs" oncontextmenu="return false;">
  <li class="active"><a href="#home" data-toggle="tab">Home Tab</a></li>
  <li><a href="#profile" data-toggle="tab">Profile Tab</a></li>
</ul>

Upvotes: 3

raghav
raghav

Reputation: 285

Try using this

$('#view-modal-nav a').click(function (e) {   
       e.preventDefault(); //Prevents Opening of Links
       $(this).tab('show'); //Shows the Corresponding tab
});

Upvotes: 0

Kamran224
Kamran224

Reputation: 1614

You can disable the links from doing anything:

$('#view-modal-nav a').click(function(event){
  event.preventDefault();
  //handle your code here
});

Upvotes: 0

Related Questions