How can I include a close/ok button at the bottom of a bootstrap multiselect component?

Currently, I am utilizing the Bootstrap multiselect tool to filter query outcomes on a specific page. After selecting one or multiple options, my goal is to have a "close" or "OK" button visible at the bottom of the selection list. Upon clicking this button, it should close the dropdown and trigger an event. It's essential for the button to always be visible even when scrolling through a long list of items.

I have experimented with different approaches to achieve this functionality, such as appending an LI element at the end of the list. However, none of these methods seem to work effectively.

<select id="multiselect" multiple="multiple">
<option value="cheese">Cheese</option>
<option value="tomatoes">Tomatoes</option>
<option value="mozarella">Mozzarella</option>
<option value="mozarella">Mozzarella</option>
<option value="mozarella">Mozzarella</option>
<option value="mushrooms">Mushrooms</option>
<option value="pepperoni">Pepperoni</option>
<option value="onions">Onions</option>
</select>

$('#multiselect').multiselect({
    maxHeight: 160,
    buttonClass: 'thisBtn',
    onDropdownShow: function(event) {
    //nothing
    }
});

Feel free to check out this basic Fiddle example: http://jsfiddle.net/kybqvjbp/3/

https://i.stack.imgur.com/lIPK3.png

Answer №1

After numerous attempts, I have finally realized that Bootstrap Multiselect is not the right fit for this project. I am now making the switch to Sumo Select. Check out my Fiddle below to see exactly what I need: https://fiddle.jshell.net/94hwnpgx/1/

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to dynamically change the border-top color of an <a> tag in a menu using a jQuery loop

I am interested in adding a colorful border-top to my menu using jQuery. I know this can be achieved with HTML by including style="border-top-color: red;", but I want to explore the jQuery method. Here is what I have attempted so far: var colors = [ ...

Cloning Div repeatedly instead of the specified quantity

My JSON data contains four sections and I want to clone my html div based on the number of sections. For example, if there are 100 sections in my JSON, I would like the div to be cloned 100 times. Currently, my div is getting cloned with the JSON data app ...

Guide to implementing this specific design using CSS within jQuery Mobile

Want to achieve the red circle effect using CSS. Currently working with jQuery mobile and AngularJS. Below is a snippet of my code: <div data-role="page" id="p2"> <div class="ui-bar ui-bar-d "data-role="header" > <a href="" data-role=" ...

Method for setting a checkbox as checked based on whether its value can be found in an array

I currently have the following input fields: <div id="my"> <input type="checkbox" value="1" name="names[]"> <input type="checkbox" value="2" name="names[]"> <input type="checkbox" value="3" name="names[]"> <input t ...

What is the proper method for implementing a scrollable effect to the <v-bottom-sheet> element within the Vuetify framework?

Within my Vue.js project, I am utilizing the v-bottom-sheet component from Vuetify framework (version 2.1.12). Upon reviewing my code, you can observe that the v-card is enclosed within the v-bottom-sheet. The issue arises with the scrollable parameter of ...

Is there a way to remove each number individually by clicking on a delete button using jQuery?

I am working with a button and the following JavaScript code: $(document).ready(function() { $('.my_button').click(function() { //var value = $(this).val() var number = $(this).val(); var value = $('#input').val($('#in ...

Stopping the AJAX call once all requested data has been fetched can be accomplished by setting a flag variable

My issue involves fetching data from a database using ajax on window scroll. Every time I scroll, the ajax call is made and data is loaded repeatedly. For instance, if there are 5 rows in the database and I fetch 2 rows per call, it should stop after fetch ...

What is the most effective method for resetting the scroll position of a browser when refreshing a page?

Portfolio Query I am in the process of setting up a basic portfolio website. My navigation bar includes various links, one of which is labeled "About Me". Upon clicking this link, the page immediately jumps to a specific section with an element ID of #abo ...

"Transferring a JavaScript variable to Twig: A step-by-step guide for this specific scenario

When it comes to loading a CSS file based on the user's selected theme, I encountered an issue while trying to implement this in my Symfony application using Twig templates. The code worked flawlessly on a simple HTML page, but transferring it to a Tw ...

Deleting the previous ion-view from DOM in Ionic v1 with Angular

I have been working on modifying an app built in Ionic v1. Within the app, there is a primary View titled 'Client's Profile' that contains links to two other Views: Support Request and Complaints. In the Support Request view, there is a Te ...

Is it possible to apply identical css styles to multiple ids at once?

Is there a way to accomplish this? .apple, .orange, .kiwi h1 {color: #892828;} I'm having trouble making it work. Any suggestions? ...

Problem with switching the view using the dropdown feature of the bootstrap datepicker

I am encountering an issue with the bootstrap datepicker when I attempt to change the view of the datepicker based on the mode selected in the dropdown. Here is the HTML code : Mode : <select id="mode"> <option value="1">Day</option&g ...

Tips for ensuring an image fits perfectly within a MUI grid

I am currently working on an application that involves a collection of cards. My tech stack includes React and MUI v5. One issue I've been facing is with the grid layout, specifically in trying to keep the image size consistent within the grid item. ...

Using jQuery to modify the border of a particular row

I am facing an issue where I need to apply a border to two specific rows in a table after it has loaded. These two rows are consistent every time the table is loaded. The code snippet below works, but the default line breaks between the table rows prevent ...

There seems to be an issue with the zebra striping in the rich:datatable component when using the rowClasses

I'm attempting to give my table a "zebra" color pattern for the rows, but it seems like the rowClasses attribute isn't functioning properly (edit: I don't see any colors applied to the table at all). Here is how I defined the styles: <s ...

Filter out the selection choice that begins with 'aa' in the drop-down menu

Here is a select field with various options: <select id="sel"> <option value="1">aadkdo</option> <option value="2">sdsdf</option> <option value="3">aasdfsddkdo</option> <option value="4"> ...

Struggles with implementing CSS Grid's dynamic column heights and expanding rows

Linked partially to Removing empty space in CSS Grid, with specific adjustments I am aiming for. Essentially, I want my rows and columns to expand and contract based on the content present. In this CodePen example, you can observe that the content of the ...

The header one tag does not wrap around content when the window size is adjusted; instead, it

I have been struggling to position my page title in the center of the header image both horizontally and vertically on my portfolio pages. I managed to get the h1 title where I want it but now I need to make it larger. The issue arises when I resize the wi ...

What is the best way to make a JSONP request using jQuery?

Whenever I try to access this API through the browser, everything works fine and I receive the correct response. However, when I attempt to call the API using jQuery AJAX, I encounter an error. *The script is being refused execution from 'http://api ...

employing jQuery for invoking webMethod results in receiving HTML... webMethod doesn't get invoked

Trying to invoke a method on an ASPX page from VisualStudio 2008 using javascript and jQuery, but only getting back the HTML of the page. Even changing the method name in the javascript does not result in an error message indicating that the method cannot ...