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 8234941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:38:39+00:00 2026-06-07T18:38:39+00:00

I am developing a customizable drop down lists using HTML and JQuery, this drop

  • 0

I am developing a customizable drop down lists using HTML and JQuery, this drop down lists are containing a hidden html div tag and input text element. If the user click on the input element the jquery code shows the hidden div tag and allow him to choose one of the list items which are embedded inside the hidden div tag. After the user chose his desire item a JavaScript code runs and reflect his chosen item to the text element. here is the html code:

<input type="text" readonly="true" class="reg-content-datacell-textfield" style="cursor:pointer;width:270px;float:left;display:inline-block" id="txtSector" name="txtSector" />
<br />
<div id="ddlSector" style="left:26px;" class="ddlist">
<ul>
    <% 
      MainDatabaseOperationsClass.DatabaseOperations databaseOperations = new MainDatabaseOperationsClass.DatabaseOperations();//db connection class
      string sqlStatement = "select * from Dbtsniper02.dbo.Sectors";//get all database sectors
      System.Data.SqlClient.SqlDataReader sqlDataReader = databaseOperations.getDataFromDBAsSQLDataReader(sqlStatement);//execute sql statement
      while (sqlDataReader.Read())
      {
     %>
     <li class="ddlListSector"><% Response.Write("(" + sqlDataReader[0].ToString() + ") " + sqlDataReader[1].ToString()); %></li>
     <%
       }
     %>
    </ul>

JavaScript Code:

$(document).click(function (event) {
if ($(event.target).parents().index($('#ddlSector')) == -1) {
            if ($('#ddlSector').is(":visible")) {
    $('#ddlSector').slideToggle();
}};
$(document).ready(function () {
$("#txtSector).click(function (e) {
            $("#ddlSector").slideToggle();
            e.stopPropagation();
            return false;
        });
$("#ddlSector").click(function (e) {
            //disallow hide the current drop down list when you click on it direcly
            e.stopPropagation();
            return false;
        });
        $(".ddlListSector").click(function (e) {
            //relect you selection of the drop down list to the parent input text field
            if ($('#ddlSector').is(":visible")) {
                document.getElementById('txtSector').value = '';
                document.getElementById('txtSector').value = $(this).html();
                $('#ddlSector').slideToggle();
            }
        });});

Now, my question is if I’ve others drop down lists like the above one, how I can Update their items data according to the user choice from the above drop down list. I’m gonna do that via change the sql statement according to the value of the text element associated with the desired drop down list but I do not know how I can trigger the event for update only the div tag content if the user select one of the drop down list items

Thank you very much, I’m highly appreciate your cooperation

  • 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-06-07T18:38:40+00:00Added an answer on June 7, 2026 at 6:38 pm

    It sounds like you want to use an AJAX call inside the ddlListSector click event listener. Make a server file that will expect the value selected and return the list of values you want (probably using a sql command). The AJAX could return plain text, JSON, or even full markup depending on how involved you want the front end to be. In the success callback of the AJAX call, update the contents of whatever other drops you have. It looks like your already using jQuery, so I recommend their docs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thank you all ahead of time. This is my first time developing a jQuery
While developing an application using gwt in ecliplse crashed. Now the server is running
For developing an devices monitor system, I am using a InetAdress isReachable method to
I am developing a space shooter game with customizable ships. You can increase the
Developing a simple game for the iPhone, what gives a better performance? Using a
Developing is more of a hobby at the moment; so apologies if this is
Developing a chrome extension using javascript is one of my university projects. I don't
Developing using MVC-3, Razor, C# Been searching around and cannot find advice I'm looking
Developing an application using SWT to work in both Linux and Windows. I created
im developing windows application using c#. i want to close the application and show

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.