2
I have a Bootstrap dropdown where a dynamic list is loaded when the user opens it. The problem is that each time there is an iteration, for example when the user deletes an item from the list, the dropdown is closed. I want the dropdown to be closed only when the user clicks on the button to close it.
How to avoid that in each iteration the dropdown is automatically closed?
Code to remove an item from the list.
$('#containerNotice').on('click', 'button[data-process="removeNotice"]', function(event) {
event.preventDefault();
var noticeId = $(this).attr('data-notice-id');
$.ajax({
crossDomain: true,
crossOrigin:true,
type:"post",
url: 'src/inc/notice/',
data: { noticeId: noticeId, DataProcess: 'remove' },
dataType: "json",
success: function(data) {
switch(data.status) {
case 'success':
$('button[data-notice-id="'+noticeId+'"]').prop("disabled", true).css('opacity', '0.2');
break;
}
}
});
});
Place a sample of the code to see how the item is removed.
– Sam
Sam.. edited the original post to insert the code
– RRV
sync & correction by f1nc0 ~ ~
– user60252
The ideal is to post code that we can use to reproduce the problem.
– user60252
Try that, young man:
$(document).on('click', '.dropdown-item', function(event){
 event.stopPropagation();
});
– Sam
Thanks Sam. It worked
– RRV