Вопрос

I want to show the dropdown box programatically using Twitter boostrap 3.

Following is the piece of code

<div class="link-propery">
   <div class="dropdown">
     <a href="#" data-toggle="dropdown" class="dropdown-toggle">
      <!--
      I don't want to use this for clicking and then showing Dropdown
      <b class="caret"></b>
     -->
     </a>
     <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
        </ul>                         
    </div>
  </div>

And when I type this in the console, the dropbox isn't visible:

$(".dropdown-toggle").dropdown();

I want to show the dropdown using programatically and not by clicking some button or link. Is there a way to do this ? Also, I have demoed the same problem using jsbin.

Это было полезно?

Решение

This makes the dropdown show programtically:

$(".dropdown-toggle").trigger("click");
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top