Resizing the Bootstrap dropdown with textbox to fit the size of the content

Check out this fiddle I made with a Bootstrap dropdown. The dropdown includes an input text box at the top. How can I adjust the width of both the textbox and dropdown container to fit the content size? For example, if I have a long text like 'ASPHALT LAY DOWN MACHINE LOOOOOOOOOOOOOONG', I don't want the content to wrap.

And there should definitely be a maximum width set as well.

<div class="editableDropdown input-group">
<input type="text" class="col-md-3 gui-input" name="load" id="load"/>
<div style="display:inline-block; width:10px">
    <button type="button" class="btn btn-default dropdown-toggle"
        data-toggle="dropdown" style="width:20px">
        <span class="glyphicon glyphicon-menu-up"></span><span
            class="glyphicon glyphicon-menu-down"></span>
    </button>
    <ul id="color-dropdown-menu"
        class="dropdown-menu dropdown-menu-right scrollable-menu" role="menu">
        <li>Select / Enter Load</li>
        <li>ARTICULATED DUMP TRUCK</li>
   </ul>
</div>

Check out my JSFiddle here!

Answer №1

Consider using the "select" component to address your issue effectively.

<select>
  <option>PAVEMENT ROLLER</option>
  <option> PAVEMENT ASPHALT MIXER "MMMMMMMMMMMMMMIX" </option>
</select>

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

The Jquery function is failing to retrieve data from the MySQL database

I am currently attempting to retrieve values from phpMyAdmin and populate them into the second select field based on the selection made in the first select field. However, I seem to be encountering an issue as the selected value is not being passed to my P ...

Utilizing objects from a JSON file within an HTML document

I'm currently in the process of creating a comprehensive to-do list, and I want to establish a JSON file that will link all the items on the list together. Despite my efforts, I find myself uncertain about the exact steps I need to take and the speci ...

Contrast the objects in views.py between two distinct model objects in Django

I am currently working on a feature that compares the skills required for different job postings (such as web development, marketing, etc) with the skills of a user who is logged in. If there is a match, the job posting will be displayed to the user. The ...

In Laravel 5.2, Ajax may cease to function properly when loaded through infinite scrolling

Currently, I am diving into the world of ajax and jquery. I am working on a page where users can like/dislike posts, and the posts are displayed by loading them with infinite scroll. By default, 5 posts are loaded each time. However, I encountered a proble ...

What is the best way to integrate asynchronous computed observable with several concurrent $.ajax requests?

I'm currently working on implementing an asynchronous computed observable following the guide provided here. While I have successfully achieved this for a single ajax call, I am facing a challenge in figuring out how to perform multiple ajax calls in ...

Dynamic sizing for sublists

I have come across a nested list structure that looks like this: <ul id="nav"> <li id="" class=""> <a href="http://site.com/wedding.html" class="">Wedding</a> <div class="flyoutWrapper" style="display:block;"> ...

I'm puzzled as to why my Contact Form is failing to send out emails

Looking to create an email send function in a pop-up on my website that can be accessed via the following link: The issue I'm facing is that while it redirects perfectly to the thank you message, the PHP implementation does not seem to work after the ...

The code is malfunctioning on this site (yet functions perfectly on a different website)

So I have a question that may seem silly, but it's worth asking. I'm attempting to create a sticky div element that stays in place when you scroll past a certain point on the page. This is the script I have: <script type="text/javascript"> ...

Determine the number of inputs within a div and increment each one by +1 using jQuery

I am currently working on developing a slider and have successfully completed most parts of it, except for the challenge of counting input fields using jQuery and assigning an incremented number to each of them upon action completion. On my slide, I have ...

Optimizing Rendering Performance: Comparing the Impact of Multiple Stylesheets vs. Single Dynamic CSS on Dynamic CSS

Currently, I am in the process of developing a website that supports "plugins" as external "displays". These plugins consist of custom full-screen HTML content managed by a client-provided JavaScript driver. The website engine utilizes an API to allow thes ...

How can I eliminate or override the CSS property from a content delivery network (CDN)?

Currently, I am utilizing swiper.js through a CDN. However, there seems to be an issue in the swiper-bundle.min.css CDN file where the .swiper-button-next and .swiper-button-prev classes are set to top:50%; like so: .swiper-button-next, .swiper-button-prev ...

The challenge of removing an event listener

There are three Div elements with a box appearance. When the user clicks on any div, a copy of that div will be added to the end. The original clicked div will no longer be clickable, but the new div will be. This process can repeat indefinitely. I attemp ...

Create a single line of content for a carousel display

Seeking a solution where I can have a container that slides sideways without stacking in rows, I have exhaustively searched for answers using different keywords like single row, inline, flexbox, and grid but to no avail. Any assistance will be highly appre ...

jQuery receiving improperly formatted HTML from method call

One issue I am facing involves a jQuery Ajax method that anticipates receiving HTML as the return. The JavaScript function's URL leads to a JsonResult method within ASP.NET MVC. To construct the HTML, I am utilizing StringBuilder and checking it in Vi ...

What is the method to adjust the margin-left in an input checkbox?

Imagine you have: <div class="home"> <input type="checkbox"/>.... </div> I am trying to add margin-left:3px to the checkbox. This is my CSS code: .home+input[type=checkbox]{ margin-left:3px; } Can anyone assist me with this? ...

The external Jquery file is being successfully loaded, however, the Jquery functions are failing to execute

I'm having an issue with my HTML partial, main index.html, and external JQuery file. Even though the file is being loaded successfully (verified through an alert function), the JQuery functions are not executing as expected. Upon checking the resourc ...

``I am having difficulty with Bootstrap as it seems to be hiding my field or

I'm currently working on a webpage that uses Bootstrap. It has a form with a label and text input field. When I add the class="custom-control-input" to the input field, Bootstrap hides it. Can someone explain why? If I don't include the class, ...

How come the spacing between my columns decreases as I expand the width of my container?

I'm struggling to grasp the concept behind the column gap in a multi-column layout. Take a look at the HTML/CSS code snippet I have set up in this Fiddle: <div class="flex-container"> <div class="flex-item">1</div& ...

What is the best way to transform data from a single form into a JSON array?

explore (handlebars) {{!< main}} <form class="ui form" action="/design/add" method="POST"> <div class="order_list"&yt; <h1>Add Product</h1> <br> {{!-- <input type="f ...

Can you explain the contrast between "#msg" and "#msg div" when used in a style tag?

<html> <head> <style> #msg { visibility: hidden; position: absolute; left: 0px; top: 0px; width:100%; height:100%; text-align:center; ...