Create a background for a dropdown list that appears unreachable, positioned above all other elements

I am encountering an issue with my autocomplete function where the drop down list appears unreadable as it is overlapping other elements on the page.

The problem lies in the fact that I did not manually create the drop down list, but rather it is generated from a database request. I am struggling to pinpoint which element's property needs to be modified in order to have the dropdown box display properly over the other elements.

I attempted to identify the elements created when the dropdown list appears, but so far it has been unsuccessful. Here is what I found:

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

Here is the CSS code I have implemented:

.ui-helper-hidden-accessible {
z-index: 1000;
display: block;
background: #f9f9f9;
border-top: 1px solid blue;

}

Below is the Autocomplete function code:

// Auto-Complete sur liste publicitaire
$("#ag_pub_publicitaire_nompublicitaire").autocomplete
({
    source: function (request, response) {
        $.ajax
        ({
            url: "https://cms.ag-carto.com/CMS_service/ws_ag_sgbdr_json/ag_sgbdr.asmx/ag_pub_publicitaire_get_list",
            data: "{'ag_sql_query_text':'"  + request.term + "','count':'0'}",
            dataType: "json",
            type: "POST",
            contentType: "application/json; charset=utf-8",
            dataFilter: function (data) { return data; },
            success: function (data) {
                var found = $.map(data.d, function (item) {
                    return {
                        value: item.ag_pub_publicitaire_nompublicitaire,
                        ag_pub_publicitaire_entityid: item.ag_pub_publicitaire_entityid,
                    };
                });
                if (found.length == 0) {
                    $('#ag_pub_publicitaire_nompublicitaire').val("Pas de publicitaire Trouvé ! Ressaisissez...");
                    $('#ag_pub_publicitaire_entityd').val("");
                    //alert("Pas de publicitaire Trouvé ! Ressaisissez...");
                }
                else {
                    //$('#infopconso').val(found.length + " Compteurs Trouvés ! Choisissez dans la liste...");
                    //$('#infopconso').val(found.length + " Compteurs Trouvés ! Choisissez dans la liste...");
                }

                response(found);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) 
            {
                alert(textStatus);
            }
        });
    },
    minLength: 3,
    select: function (event, ui) 
    {
        if (ui.item.ag_pub_publicitaire_nompublicitaire == "-1") {
            $('#ag_pub_publicitaire_nompublicitaire').val("");
            $('#ag_pub_publicitaire_entityd').val("");
            $('#ag_pub_publicitaire_nompublicitaire').focus();
        }
        else {
            $("#ag_pub_publicitaire_entityid").val(ui.item.ag_pub_publicitaire_entityid);
        }
    }
});

At this point, it seems like I may not be targeting the correct class for modifications. Any guidance or suggestions on how to proceed would be greatly appreciated :)

Thank you in advance and I hope you have a wonderful day!

Answer №1

You seem to be selecting the wrong CSS div.

Here's the solution: It should target the ul with the ID #ui-id-1, which displays the autocomplete functionality.

.ui-widget.ui-widget-content {
    z-index: 1000;
    display: block;
    background: #f9f9f9;
    border-top: 1px solid blue;
} 

Answer №2

I realized my mistake - I forgot to include the jquery-ui.css file in my html, resulting in the undesired outcome.

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

Wrapping dynamic page titles with comment tags in NextJS for cleaner code

I am currently working on NextJS version 12. In my project, I have a file named Layout.js which contains the following code: import Head from "next/head"; const Layout = ({children, pageTitle, mainClass}) => { return ( <> ...

Learn how to showcase video information in a vue.js template

I am having difficulty displaying a saved media (video) file on another page after collecting it using the ckeditor5 media option. The data is stored along with HTML tags generated by ckeditor, so I'm using v-html to display other content like <p&g ...

Trouble displaying CSS content image in Internet Explorer

Usually, I use Chrome as my default browser. However, I recently decided to test whether my website functions properly on other browsers as well. In Chrome, the header displays my logo with great quality using content:url. But when I tried accessing my w ...

What are some ways to restrict dynamic form submissions?

$(document).ready(function(){ var i = 1; $('#add').click(function(){ if(i < 5){ i++; $('#dynamic_field').append('<tr id="row'+i+'"><td><div class="form-group">& ...

Content that can be scrolled within a React.Box container

I am struggling with a particular view. The columnBox I have can potentially hold a large number of items, but for some reason it's not scrolling in the view. I've already tried setting overflowY to auto, but since I don't know the exact hei ...

Converting PHP variables to JavaScript variables: A step-by-step guide

I'm trying to figure out the most efficient method for retrieving PHP variables using AJAX and then transforming them into JavaScript variables. Imagine I have the following code in my PHP file: echo $total; echo $actual; Edit: JSON echo json_enco ...

Incorporate Calendly Script into your NextJs application

I'm currently working on integrating Calendly into my Next.js project. However, I am unsure about the process. My goal is to embed it on a specific page rather than in _app or _document. Here is what I have attempted so far: import Script from &apos ...

Error message: Laravel 8 and Ajax - 405 Error - Method Not Allowed

Whenever I try to input something into the form, it keeps showing an error message saying "405 Method not allowed". How can I resolve this issue? This is my route: Route::get('/search' , [HomeController::class, 'searchPost']) ...

Fancybox 2 - CSS styles vanish when using Ajax request

I have a fancybox2 with static dummy content that has styling applied. It works fine, but now I need to load dynamic content via ajax. However, when I make the ajax call, the required content loads but loses all css styling, most likely due to changes in t ...

Utilizing window.location.pathname in Next.js for precise targeting

Are you familiar with targeting window.location.pathname in NEXT.JS? I encountered a red error while using this code in Next.js const path = window.location.pathname console.log(path) // I am able to retrieve the pathname here Then { ...

Is there a way to eliminate the border surrounding every cell in a table?

I'm facing an issue with a table on a page with a gray background. The challenge is to remove the borders of the cells in the table. <table width="510"> <tbody> <tr> <td style="background-color: #fff;" colspan="2" width="510"> ...

CSS: Trouble with elements positioning

I am attempting to position two boxes on top of each other at the bottom of a different div. Here is the code I have: <div style = "height:400px;width:400px;border:1px solid #000;"> <div style = "position:relative;height:100px;width:100px;bor ...

AngularJS: when only one line is visible, the other remains hidden

Issue with AngularJS: Only One Line Displaying Instead of Both I am encountering an issue with my AngularJS code where only one of the elements is displaying on my page. function Today($scope, $timeout) { $scope.now_time = 0; (function update() { ...

CSS: Alignment of Lists with Three Items

In my CSS, I am aligning two parts of a list item to the left and right side like this: ul li div.left { float: left; } ul li { text-align: right; } <ul> <li><div class="left">On the left</div>On the right</li> ...

Preserving the top line or heading while cutting through a table

In my HTML, I have a table with the following structure: <table id="table"> <tr> <td>ID</td> <td>Place</td> <td>Population</td> </t ...

elements of bootstrap overlapping one another

I have created a website using Bootstrap, which can be accessed at this link. The homepage is experiencing alignment issues, with sections colliding with each other. To prevent this collision, I had to add margin-top like the example below: ...

Issue with transitioning from Bootstrap 2 to Bootstrap 3 navbar

I am facing an issue with my navbar that collapses perfectly. However, when using the script below to automatically hide the menu upon clicking a menu item: $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { $('.navba ...

Why does my POST request result in an express get being triggered?

When my express server runs the deliverCard() method, it sends a set of key/value pairs. app.get('/', (req, res) => { let card = deck.deliverCard(); console.log('get', card) res.render('layout.ejs', {element:card}); ...

Testing the equality of nested arrays: A step-by-step guide

My maze generator creates walls for each "cell", resulting in duplicate walls - such as the left wall of one cell being identical to the right wall of the adjacent cell. I have managed to convert the maze data into a different program where it is stored in ...

Transfer Parameters from the Screen to the Header Component in React Navigation

I am facing an issue where I am unable to pass a function as parameter to the header component in react-navigation v5. In the code snippet provided below in filtersscreen.js, my intention is to pass savefilters to headerRight which is located in navigatio ...