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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:48:21+00:00 2026-06-11T17:48:21+00:00

I want something that functions like this: You click on a name such as

  • 0

I want something that functions like this: You click on a name such as Mary Smith and it dynamically generates the data-name value in another ul and li element. I have that part working,
however, I need it to not change all of the li elements to that value. Each time Mary Smith or Tom Jones is clicked it needs to create an li with that value and not change the value of the existing ones.

You can find the fiddle here: http://jsfiddle.net/rsxavior/zHkS8/3/ Basically I need it to function as if the .account-select class could be considered the ‘this’ value for the function. I am not sure of a way to go about doing that.

<ul>
    <li><a href="#" class="account" data-name="John Smith">John Smith</a></li>
    <li><a href="#" class="account" data-name="Mary Jones">Mary Jones</a></li>
</ul>

<ul class="account-hidden-li"></ul>

$('.account').click(function () {
    $('.account-hidden-li').append('<li class="account-select"><a class="close bcn-close" data-dismiss="alert" href="#">&times;</a></li>');
    $('.account-select').text($(this).data("name")).prependto();
});

http://jsfiddle.net/rsxavior/tS9H8/9/

  • 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-11T17:48:22+00:00Added an answer on June 11, 2026 at 5:48 pm

    I’m a little confused, I think there might be another error in your code. Using .text(), you are wiping out the <a> element within each li.account-select.

    I think this solves your question and also preserves your “close” links:

    $('.account').click(function () {
        $('.account-hidden-li').append('<li class="account-select">'+$(this).data("name")+'<a class="close bcn-close" data-dismiss="alert" href="#">&times;</a></li>');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to do something like $('a.filter-link').click(function(e) { e.preventDefault(); var that = $(this), categoryId
What I want to do is something like this: $(.chat-wrapper).on(click, .chat-wrapper li, function(){ $(this.name).hide();
I have a form that looks something like this: <form id=uploadForm name=uploadForm method=post enctype=multipart/form-data>
I want something that will receive me the processes details, like I receive with
I am not even sure how to ask this question. I want something that
this is something that i don't want to program, but i was looking for
Q1. I want to grep something like that: grep -Ir --exclude-dir=some*dirs my-text ~/somewhere but
What a want to do is something like that: declare @id int set @id
I want to do something that seems like it should be fairly simple, but
I want to make something that makes much sense, but I think its not

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.