Reputation: 123
So I'm trying to:
1) Use Bootstrap to make a button that will trigger a dropdown. (done)
2) That dropdown, has injected < li >'s in it, from a script doing an ajax call. Each of those triggers a function that populates other elements on the page with data from the list item. (done)
3) On click of the < li >, everything is populated properly via jquery to other elements (labels, other inputs), except when I'm trying to overwrite the text of the button itself.
When I click on an item in the list, the original button disappears along with the popped-up dropdown list. Basically, I want to continue for the dropdown < ol > and it's items to disappear, but for the originating button to remain, but with the text of that button updated.
I've tried e.stopPropagation on the dropdown, but then the whole thing never disappears.
Upvotes: 0
Views: 92
Reputation: 5041
If I understood what you want to do correctly, you have to stopPropagation in the li, not in the button.
$('.yourLi').click(function(e){
e.stopPropagation();
//whatever thing you are doing when a li is clicked
});
Upvotes: 1