jquery - Bootstrap prevent nav-dropdown closing on click -


i'm fighting pice of code time , of solutions find has't worked.

i want prevent menu closing after clicking on 1 of links. code:

 <li class="nav-dropdown">                 <a href="#" title="menu levels">                     <i class="fa  fa-fw fa-folder-open"></i> manage devices                 </a>                 <ul class="nav-sub">                     <li>                         <a href="@url.action("addwizard", "device")" id="test">                             <i class="fa fa-fw icon-plus"></i> add device                         </a>                     </li>                     <li>                         <a href="@url.action("removedevice", "device")" >                             <i class="fa fa-fw icon-close"></i> remove device                         </a>                     </li>                 </ul>               </li> 

i've been trying tricks stop propagating. example not working me:

  $('#test').on('hide.bs.dropdown', function (e) {         console.log("test");         return false;     }); 

any ideas?

regards, piotr

you can use click function.

$('#test').on('hide.bs.dropdown'... doesn't work because #test isn't dropdown menu.

$('#test').click(function(e) {   e.stoppropagation(); // or return false }); 

codepen


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -