Preventing a drop down list of bootstrapping after clicking on a click

I am trying to check the boxes in the bootstrap dropdown. I don’t want the drop-down list to be closed by click, but I still want to close it if they click elsewhere on the website. I still want to disable other javascript actions when I click on the dropdown menu. I have an example of an exact reference to what I want. This example closes the click on a click, but it opens when called from a drop-down list.

$(function () { $('.dropdown.keep-open').on({ "shown.bs.dropdown": function() { $(this).data('closable', false); }, "click": function() { $(this).data('closable', true); }, "hide.bs.dropdown": function() { return $(this).data('closable'); } }); }); 

http://jsfiddle.net/KyleMit/ZS4L7/

+3
drop-down-menu twitter-bootstrap
source share
1 answer

I finally understood. code below:

 $(function() { $('.dropdown.keep-open').on({ "shown.bs.dropdown": function() { $(this).data('closable', false); }, "click": function(event) { $(this).data('closable', false); }, "hide.bs.dropdown": function(event) { temp = $(this).data('closable'); $(this).data('closable', true); return temp; } }); }); 

Edit: Added missing semicolon in line 11.

+6
source share

All Articles