Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7050681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:10:22+00:00 2026-05-28T03:10:22+00:00

I have two JQuery autocomplete’s on a screen. One is mandatory, the other is

  • 0

I have two JQuery autocomplete’s on a screen. One is mandatory, the other is not.

I have some javascript which sets them up slightly differently.

The problem I have is styling the drop down with a ‘mandatory’ css class to make it show up as mandatory visually (to non-visually impared users…)

I have styled the input box that is created, that’s not a problem.

(function ($) {
            $.widget("ui.comboboxMan", {
                _create: function () {
                    var self = this,
                    select = this.element.hide(),
                    selected = select.children(":selected"),
                    value = selected.val() ? selected.text() : $("#PickListSessionDefault").val()
                    var input = this.input = $("<Input>")
                    .addClass("ui-textbox")
                    .addClass("mandatory")
                    .insertAfter(select)
                    .val(value) 

But I want to add the same madatory class to the pick list.

I tried this:

                    open: function (event, ui) {
                        $('ul.ui-autocomplete').addClass('mandatory');
                        $('ul.ui-autocomplete li').addClass('mandatory');
                    },  

But that results in some of the items not having the background over the WHOLE width. there is a thin strip of white to the left and a thicker one to the right. CSS is:

.mandatory
{
    background-color: #b9ffb9;
}

Suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:10:23+00:00Added an answer on May 28, 2026 at 3:10 am

    Perhaps you want to use the _renderItem. I used a custom format with category an id etc, yours will differ.

    snip...rest of autocomplete here
        open: function(event, ui)
            {
            }
    }).data("autocomplete")._renderItem = function(ul, item)
    {
        return $("<li></li>")
            .data("item.autocomplete", item)
            .append("<a>" + item.Id + " <span class='autoCompCat'>" + item.Category + "</span> <span class='autoCompText'>" + item.MyText + "</span></a>")
            .appendTo(ul);
    };
    

    in my case, I used a function in the source with some ajax stuff to add to the item: example function not optimal just painfully obvious 🙂

    function myAutocompleteJSONParse(data)
    {
        var rows = new Array();
        var rowData = null;
        for (var i = 0, dataLength = data.length; i < dataLength; i++)
        {
            rowData = data[i];
            rows[i] = {
                Id: rowData.ProcedureCode,
                value: rowData.Description,
                label: rowData.Description,
                Category: rowData.Category,
                MyText: rowData.Description
            };
        }
        return rows;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two autocomplete scripts, one of them makes use of (A) php/mysql/html/jquery and
I have two jQuery autocomplete textboxes on a mvc web page. One that returns
I have a page, which uses jQuery Autocomplete on the second two textboxes (investigator
Assuming I have the following two JQuery functions - The first, which works: $(#myLink_931).click(function
How do I have two effects in jQuery run in sequence , not simultaneously?
I have two scripts running on the same page, one is the jQuery.hSlides.js script
I'm using the jQuery Validation JS I have two contact forms, the main one
I have two jQuery UI Autocomplete widgets set up. With the first autocomplete, the
I am using devbridge jquery autocomplete plugin . I have combined two tables in
I'm using two jquery ui widgets, autocomplete and tabs. They each have their own

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.