I have a question with Twitter Bootstrap, I'm using the Dropdown plugin and I'm trying to create a tag selector, I created an example in this link:
I've tried this:
event.stopPropagation;
return false;
Does anyone have a better solution that does not close the dropdown when selecting a tag?
Note: Click on "New Tag".
Thanks!
This works:
$('.dropdown-menu').on('click', 'li', function(event){...});
EDIT: Fixed! http://jsfiddle.net/gatnc/5 - Caio Tarifa 2012-04-03 23:00
The problem with "live" it's bound to the document. This means the close event won't get intercepted by stopPropagation. If you're using jQuery 1.7.1, you can swap out "live" for "on", like so:
$('.dropdown-menu li').on('click', function(event) {
That'll bind the event to the element, and then things like stopPropagation will work.
live()
, the event is bound to the document
so event.stopPropagation()
doesn't get fired until it's too late - AlienWebguy 2012-04-03 22:13