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

  • Home
  • SEARCH
  • 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 7919261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:48:35+00:00 2026-06-03T15:48:35+00:00

Here is the situation : I have a vertical menu with div. Each div

  • 0

Here is the situation :
I have a vertical menu with div. Each div has an id. When I click on a div, it adds a select list within the div using the following method :

$ ( '#mydiv' ).on ( 'click', function ( ) {
  var select = '<select name="menuList"><option value="test">test</option>...</select>';
  $ ( '#mydiv' ).html ( select );
} ) ;

What I am trying to do is simple. I would like to define the user choice as a text when the option has been selected. I have tried this but it doesn’t work :

$ ( 'select[name="menuList"]').on ('blur', function ( ) {
  $ ( '#mydiv' ).html ( $ ( 'select[name="menuList"] option:selected' ).val ( ) );
} );

Moreover, the other problem is that when I choose an option from the list, the selected field doesn’t remain the user choice, it goes back to the first position of the list. Basically, the problem is not a real one because I immediately replace the list by a text field containing his choice but I’d like to understand why this is happening.

  • 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-03T15:48:37+00:00Added an answer on June 3, 2026 at 3:48 pm

    Because you are setting the HTML (destructively) on the click event, every time you click the div the html is replaced. You’d be better setting the html on document.ready and them using hide / show or creating a flag which you set when the content is set and checking it each click so you know not to re-create the menu.

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

Sidebar

Related Questions

Here is my situation: I have one table that contains a list of drugs
here's the situation: I have a where in every cell all the area has
Here's the situation I have a webpage which has one drop down called prefer.
Here's the situation - I have a vb.net exe compiled for X86 machines using
I have the following situation here: I do some drawing on a graphics scene,
Here's the situation: I have a combobox within a button,, In expression blend when
Here's the situation: I have a label's text set, immediately followed by a response.redirect()
Here is the situation: I have been called upon to work with InstallAnywhere 8,
Here's the situation: we have an Oracle database we need to connect to to
Here is the situation : we have to offer a customer with a web-based

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.