Search code examples
bootstrap-multiselect

bootstrap multiselect adding custom text input


I am trying to add a text box as one of the options because I am using the multiselect as a filtering element on a separate list. I want the text box to act as a free text filter. I have tried many things but cant get this to work...

I tried enabledHTML and inserted the input box in the option however although the textbox shows it is disabled (i cant enter any text - it seems to be blocked by a parent element but I cant figure out which one)

I tried to hijack the textbox that shows up when using enableFiltering. The problem is I cant seem to disable the event which causes filtering on the list when i enter text into the textbox. I dont want that filtering to happen, just want the text to remain in the textbox ideally with a checkbox next to it and then I can handle my list filtering by referencing the textbox value.

Can anyone advise how to do this?


Solution

  • Figured it out. There's an onchange event called on all inputs in the dropdown. Blocking propogation allows me to make use of it. So enabled HTML, added the input text box as an option. And then bound a change event to that text box and stopped propagation. Now I can use it.