Customize the dimensions of the bootstrap dropdown menu

I have a dropdown feature on my bootstrap second textbox with a lot of content. The issue is that the dropdown overflows and leaks into the textbox located on the left below it. How can I resize it properly to fit within the confines of the drooping textbox?

UPDATE:

In the image below, you can see a RED area indicated. This is where I need the dropdown to be confined to:

https://i.sstatic.net/DPnoo.png

<!doctype html>
<html lang="en">

<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
  <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ddbfb2b2a9aea9afbcad9de8f3eff3ee">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">

  <style>
    .dropdown .list-group-item {
      width: 100px!important;
    }
  </style>
</head>

<body>
  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b1d3dedec5c2c5c3d0c1f1849f839f82">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7L+jL+jjXkk+Q2h455rYXK/7HAuoJ+I4" crossorigin="anonymous"></script>
  <div class="input-group">
    <button type="button" role="button" title="Delete" class="material-symbols-outlined text-secondary input-group-text bg-theme delrow">delete</button>
    <input type="text" placeholder="Key" class="form-control key">
    <input type="text" placeholder="Value" class="form-control form-select value suggest coltitle-tags meta-tags typeable dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">

    <div class="dropdown-menu border-secondary fdropdown-menu show" data-popper-placement="bottom-start" style="position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate3d(16.8px, 38.4px, 0px);">
      <div>
        <input type="search" placeholder="Type to search..." class="m-3 mt-2 form-control search"> <span class="dropdown-tag-questions"><a class="dropdown-tag-questions-item" data-value="{{Timestamp}}" title="Timestamp
    " href="#">Timestamp</a></span><span class="dropdown-tag-questions"><a class="dropdown-tag-questions-item" data-value="{{Email Address}}" title="Email Address
    ⓘ Column B" href="#">Email Address</a></span>...
        <li>
          <hr class="dropdown-divider">
        </li>
        <span class="dropdown-tag-meta"><a class="dropdown-tag-meta-item" data-value="{{Response Number}}" title="Response Number
    ⓘ Form Response number" href="#"> Response Number </a></span><span class="dropdown-tag-meta"><a class="dropdown-tag-meta-item" data-value="{{Form Name}}" title="Form Name
    ⓘ The name of the Google Form" href="#"> Form Name </a></span>...
      </div>
    </div>


    <button type="button" role="button" title="Add new" class="material-symbols-outlined input-group-text bg-theme addrow">add</button>
  </div>
  <script>
    $(document).ready(function() {
      $(`body`).on("click", '.addrow,.addnewrow', function() {
        $(this).parent().after(`<div class="input-group">
                        <button type="button" role="button" title="Delete" class="material-symbols-outlined input-group-text bg-theme delnewrow">delete</button>
                        <input type="text" placeholder="Key" class="form-control key">
                        <input type="text" placeholder="Value" class="form-control form-select value suggest coltitle-tags meta-tags typeable dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" data-bs-auto-close="outside" aria-expanded="false">
                        <button type="button" role="button" title="Add new" class="material-symbols-outlined input-group-text bg-theme addnewrow">add</button>
                            </div>`);
        addsuggest(wid, tid);
      }).on("click", '.delnewrow', function() {
        $(this).parent().remove();
      });
    });
  </script>
</body>

</html>

Answer №1

After posting a comment, I decided to experiment with adding a .dropdown wrapper, which seemed to guide it in the right direction.

<!doctype html>
<html lang="en>

<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
  <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="187a77776c6b6c6a7968582d362a362b">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">

  <style>
    .dropdown .list-group-item {
      width: 100px!important;
    }
  </style>
</head>

<body>
  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ddbfb2b2a9aea9afbcad9de8f3eff3ee">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
  <div class="input-group">
    <button type="button" role="button" title="Delete" class="material-symbols-outlined text-secondary input-group-text bg-theme delrow">delete</button>
    <input type="text" placeholder="Key" class="form-control key">
    <input type="text" placeholder="Value" class="form-control form-select value suggest coltitle-tags meta-tags typeable dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
<div class="dropdown">
    <div class="dropdown-menu border-secondary fdropdown-menu " data-popper-placement="bottom-start" style="position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate3d(16.8px, 38.4px, 0px);">
      <div>
        <input type="search" placeholder="Type to search..." class="m-3 mt-2 form-control search"> <span class="dropdown-tag-questions"><a class="dropdown-tag-questions-item" data-value="{{Timestamp}}" title="Timestamp
    " href="#">Timestamp</a></span><span class="dropdown-tag-questions"><a class="dropdown-tag-questions-item" data-value="{{Email Address}}" title="Email Address
    ...
    ...
    ...
</body>

</html>

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

Customizing the appearance of Indicators and Paginator in PrimeNG Carousel

I have integrated a carousel using PrimeNG which has the following design here Take note of the style of the carousel indicators and navigators. I want to achieve the default style of indicators/navigators for the carousel as shown here I have included t ...

Verify whether the element in the DOM is a checkbox

What is the method to determine whether a specific DOM element is a checkbox? Situation: In a collection of dynamically assigned textboxes and checkboxes, I am unable to differentiate between them based on their type. ...

Customize the border style for the span element

I attempted to use the code below in JavaScript/jQuery to adjust the border thickness. Unfortunately, it seems to be ineffective. Can someone please assist me? //$("span").css({"border":"4px solid green"}); document.getElementById("192.168.42.151:8984_ ...

Using AJAX to search through paginated pages is quite simple and effective

Currently, I have developed a JavaScript script that filters names within a list. However, a problem has arisen with pagination - as the list paginates, I am unable to retrieve names without refreshing the page. Is there a way to use AJAX to access and dis ...

Unable to retrieve jwt token from cookies

Currently, I am developing a website using the MERN stack and implementing JWT for authentication. My goal is to store JWT tokens in cookies. Despite invoking the res.cookie function with specified parameters (refer to the code below), I am facing difficul ...

Transferring radio button selections from a form to Google Analytics upon submission

I have a form where I can capture user selections from radio buttons and a drop-down element using the .blur() event. However, I am struggling with pushing this data to Google Analytics (GA) when the user clicks the submit button. Currently, my script loo ...

Unable to modify the model of the directive

I'm facing an issue where additional elements added to my array within a controller of a directive are not being displayed in the view. What's even more frustrating is that when I print my model, it doesn't reflect the new elements that have ...

What is the best way to combine the elements within an array with the elements outside of the array in order to calculate their sum?

The goal is to create a function that determines the winner using two input integers. The function should return the first input if it is greater than the second input. function determineWinner(a, b) { let result = [] for (let i = 0; i < 3; i++) ...

A guide to sending HTML emails with the Linux command line

I am in search of a solution to send emails in HTML format using only the Linux command line and the "mail" command. So far, I have tried the following: echo "To: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99f8fdfdebfceae ...

What is the best way to locate and extract the content of an HTML element using XPath in Selenium with VBA?

I am currently seeking a solution to extract the content of an element with the name "data-testid" from a website. This specific element appears approximately 35 times within various contexts in the HTML code. The particular element I am interested in look ...

I am attempting to attach my anchor tag to my list item, but for some reason it does not appear to be functioning correctly

I am attempting to attach my a tag to my li tag and then place that li in the messages id, but for some reason it is not functioning properly. When I attach the message.url to #messages, it displays on the screen correctly. However, when I connect the var ...

Turning off v-navigation-drawer for certain routes in Vue.js

I currently have a v-navigation-drawer implemented in my webpage using the code below in the App.vue file. However, I am looking to disable it on certain routes, such as the landing page: <v-app> <v-navigation-drawer id ="nav" persistent : ...

Guide to center-aligning ElementUI transfer components

Has anyone successfully incorporated ElementUI's transfer feature inside a card element and centered it? https://jsfiddle.net/ca1wmjLx/ Any suggestions on how to achieve this? HTML <script src="//unpkg.com/vue/dist/vue.js"></ ...

URL for Database Query String

I need help figuring out how to extract database information using a URL. On the page, each event entry should have a hyperlink that leads to a new form where administrators can record results for that specific event. The EventID is passed as a query st ...

Encountered a network error 500 when attempting to access a CodeIgniter controller action through Ajax

I am facing an issue with my admin controller. Within this controller, I have a processReq function that is triggered by a button click event. However, every time I click the button, I encounter an error message: "NetworkError: 500 Internal Server Error ...

The value of the input field in jQuery is not defined

I am encountering an issue with an error: jQuery input val() is undefined. I have 3 inputs that are all referencing one item. When I add a new row, I can create a new item (3 rows). All of these rows need to be organized in an array to be sent to a PHP f ...

When utilizing the React API Fetch, there may be instances where not all data is returned. However

Having some trouble with my FetchData class. I am receiving a list of data, but it's in an array format. When I try to access specific values like countries: data.Countries[0], I can get individual values based on the index. However, what I really wan ...

Issues with AngularJS <a> tag hyperlinks not functioning as expected

After performing a search, I have an array of objects that needs to be displayed on the template using ng-repeat. The issue arises when constructing the URL for each item in the array – although the ng-href and href attributes are correct, clicking on th ...

What is the process for retrieving user data from Postgresql using axios.get when the data is already stored within the database?

Using auth0 for user sign up, my React app automatically retrieves user information upon logging in and sends a POST request with axios to the backend. The user ID is stored in userId and the user information is stored in currUser. However, upon logout and ...

Adjusting the "lang" attribute to modify the font style

By using the HTML lang attribute and setting it to "en", I noticed that some of the div fonts and colors were changing to the default ones in Bootstrap. Although I am utilizing the Bliss2 Regular font, the default font style seems to be taking precedence. ...