Topic: Make Dropdown main point clickable

BP-Webmedia pro asked 5 years ago

Hi, I want to make my Dropdown main point href linked on to a certain site.The idea is:-First klick, the dropdown menu opensSecond klick:- Href Link goes to another pageIs it possible?

BP-Webmedia pro answered 5 years ago

Hi, many thanks! This is exactly what I wanted. Greetings

Mikołaj Smoleński staff answered 5 years ago

Hi, I have prepared an example for You. I am not sure about Your issue, but take a look at the following code:
<!-- Basic dropdown -->
<div class="btn-group">
 <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" data-href="" aria-haspopup="true" aria-expanded="false">Basic dropdown</button>
 <div class="dropdown-menu">
  <a class="dropdown-item" href="#">Action</a>
  <a class="dropdown-item" href="#">Another action</a>
  <a class="dropdown-item" href="#">Something else here</a>
  <div class="dropdown-divider"></div>
  <a class="dropdown-item" href="#">Separated link</a>
$(document).ready(function () {
 let count = 0;
 $('.dropdown-toggle').on('click', function() {
  let url = $(this).attr('data-href');
  if(count % 2 == 0) {,'_blank');
Best Regards

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No