This is the very simple modal window that I am using to select a task.
<div id="add_task_modal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Lookup Task</h5>
</div>
<div class="modal-body">
<select id="select_customer_name" placeholder="Select a customer..."></select>
<select id="select_project_name" placeholder="Select a project..."></select>
<select id="select_task_name" placeholder="Select a task..."></select>
</div>
<div class="modal-footer">
<button id="submit_add_task" class="btn btn-primary">Add</button>
<button class="btn btn-primary" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
There are three <select>
s inside that are selectized. I can post this code if requested but I do not think it is relevant.
Basically the problem is that the dropdowns extend beyond the bottom of the modal window in some cases (this is what I want), and if you click on an option that is below the bottom it will close the modal. Obviously I can make the modal static but that is not the functionality I want.
Is there any way to prevent the click event from closing the modal in this circumstance?
EDIT: These are the two click events I get when clicking on one such <option>
:
click { target: div#add_task_modal.modal.fade.show , buttons: 0, clientX: 1251, clientY: 370, layerX: 1251, layerY: 370 }
click { target: div#add_task_modal.modal.fade, buttons: 0, clientX: 1251, clientY: 370, layerX: 1251, layerY: 370 }
stopPropagation()
so the click event doesn't bubble up to the rest of the DOM? – Faludi$(".selectize-dropdown").click(function(evt) { evt.stopPropagation(); evt.preventDefault(); });
This is what I have tried, but no use. – Illfavored<select>
options that extend below the modal. When I click any option that extends below the modal, it does not close the modal. I'm guessing you either have a JS error, or it's a symptom ofselectize.js
. Can you post a minimal, reproducible example? – FaludistopPropagation()
andpreventDefault()
but unfortunately it had no effect. At this point I'm out of ideas, sorry! You may want to look into how Selectize handles events and keep investigating. – Faludi