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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:23:45+00:00 2026-06-12T19:23:45+00:00

I am trying the following. I have the function that displays a hidden list

  • 0

I am trying the following.

I have the function that displays a hidden list based on the dropdown selecttion.

Please visit here to see it:

http://jsfiddle.net/vSyK6/28/

What I am trying to do is when Option1 is selected, it will display the content of #List-Option1 Content and if Option2 is selected it will display content #List-Option2.

Now, what I want to accomplish is when both content is displayed and if you select again of the options it should add another list with the option selected.

Basically if we go by this order:

Option1….then
Option2….then

We select again Option1 and it should display like this

Option1 Content
Option2 Content
Option1 Content

if we select Option2 again it should display like this:

Option1 Content
Option2 Content
Option1 Content
Option2 Content

Right now what it does it displays the selected item in the last row of the list. It doesn’t add a new list row. This function of course is not implemented. I need the solution for that 🙂

Hope i make sense 🙂

Any help is appreciated

  • 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-12T19:23:47+00:00Added an answer on June 12, 2026 at 7:23 pm

    I’d suggest the following:

    $('#List-Option1, #List-Option2').hide();
    
    $('#category').change(function() {
        var str = $('#category').val();
        $('#List-' + str).clone(true, true).attr('id', function(i,v){
            return v.replace(/\d+/,'') + (parseInt($('#box li[id^="List-Option"]').length,10) + 1);
        }).appendTo('#box ul').show();
    });​
    

    JS Fiddle demo.

    References:

    • attr().
    • attribute-starts-with (attribute^="value"]) selector.
    • clone().
    • parseInt().
    • string.replace().
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following. I am trying to trigger the function based on the
I have the following C++ function definition, which I am trying to call through
The following image have been uploaded to show what I am trying to do
I have been trying the following interface IUIntegral : IEquatable<Byte>, IEquatable<UInt16>, IEquatable<UInt32>, IEquatable<UInt64> {
I'm trying to achieve the following: I have a directory with multiple video files
I'm trying to do the following: I have a set of images and select
What I am trying to accomplish is the following: I have a Country box.
I'm trying to figure out how XSLT process namespace prefixes and have following example:
I am trying to understand isolation/locks in SQL Server. I have following scenario in
Trying to use JSTL but have the following problem: Index.xhtml page: <?xml version=1.0 encoding=UTF-8?>

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.