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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:51:24+00:00 2026-05-28T17:51:24+00:00

Backstory:I’ve created a tool to type in and press enter to add as many

  • 0

Backstory:I’ve created a tool to type in and press enter to add as many email addresses to a member signup as necessary. The emails are added into a scrollable div as list items with an alternating zebra stripe and a red x to the right of each email allowing the user to delete the specific email they wish to in the list.

Here’s the thing: the actual inputs are hidden and separate from this list form. The list form is really just for the viewing pleasure/ease of the UX.

Question: I have successfully targeted the list item to remove that I wish to but this does not remove the input associated with the list item. How would I target this separate list item?

Here is the basic code I’ve created:

Targets and successfully removes the closest list item associated with the red x

$(".RemoveEmailBtn").live('click', function(e) {
    $(this).closest("li").fadeOut(300, function() { 
        $(this).remove();    
    });

// The additional code that is creating the list and inputs to give you a better idea of what I'm saying

} else {
    $('#Members').append('<li class="EmailList">' + email + '<span class="RemoveEmailBtn">x</span>' + '</li>');                                         
    $("li.EmailList:odd").addClass("oddItem");                     
    $('#add_email_field').append('<input class="email_inputs" type="hidden" name="emails" value="' + email + '"/>');
    $('#EmailInput').val('');
}

// The HTML as well: The HTML works perfectly. Again, the only issue is when I hit delete it only deletes the list item and not the hidden input
<div id="add_email_entry"><!-- add_email_entry -->
    <h2>Enter E-mail Addresses for New Members below:</h2>
    <div id="add_email_field"><!-- add_email_field -->
        <fieldset>
            <input class="xlarge" id="EmailInput" name="emailInput" size="30" type="text"/>
            <button id="AddEmailBtn" class="btn primary">Add</button>   
                <br/>
            <ul class="member" size="5" multiple="multiple" name="multiSelect" id="Members">
            </ul>
        </fieldset>
    </div>
    <!-- /add_email_field -->
</div>
<!-- /add_email_entry -->

Now how do I remove both the list item AND the input so when I hit the red X it removes both and not just the list item? The inputs are sticking around because I can’t figure out how to target each input related to the list item I have figured out how to delete.

Thanks in advance!

  • 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-28T17:51:25+00:00Added an answer on May 28, 2026 at 5:51 pm

    You’ll have to find inputs with class .email_inputs, and the value attribute matching the email you just removed from the list. Something like:

    $('.email_inputs[value=user@example.com]');
    

    However, it would be much simpler if you just added the hidden inputs inside the list item you create to display the email, then just removing the li would remove the input too…

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

Sidebar

Related Questions

Backstory: I'm trying to draw as many squares the the screen as possible using
Short backstory: My UI code uses tabs heavly and as time progresses and features
Brief backstory, our previous developer used ASIHTTPRequest to make POST requests and retrieve data
A little backstory, currently I'm working on implementing a triangle rendering system in Expression2
Bit of a backstory to this one... I have an ASP.NET Login App on
Alright, I'm at my wit's end on this issue. First, backstory. I'm working on
Backstory: I have MP3 and FLAC files in my music collection. I have MP3s
Backstory: So I was driving to band practice this evening. My car has a
Quick backstory...I have some training in database design and administration. I have used them
There's a convoluted backstory involving how I came across this, but why is the

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.