admin管理员组文章数量:1431046
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!
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:
http://jsfiddle/gatnc/
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!
Share Improve this question edited Apr 3, 2012 at 22:56 Andres I Perez 75.4k21 gold badges159 silver badges139 bronze badges asked Apr 3, 2012 at 21:52 Caio TarifaCaio Tarifa 6,04312 gold badges49 silver badges75 bronze badges2 Answers
Reset to default 3This works:
$('.dropdown-menu').on('click', 'li', function(event){...});
Updated jsFiddle
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.
本文标签: javascriptTwitter Bootstrap Dropdown with Tags SelectorStack Overflow
版权声明:本文标题:javascript - Twitter Bootstrap Dropdown with Tags Selector - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745570506a2664018.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论