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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:47:35+00:00 2026-06-15T14:47:35+00:00

I have the next HTML: <div class=grid_4 col id=countries> <div class=header>COUNTRIES</div> <div class=scroll-area> <ul

  • 0

I have the next HTML:

 <div class="grid_4 col" id="countries">
            <div class="header">COUNTRIES</div>
            <div class="scroll-area">
                <ul id="countrySelector">

                <li><input type="checkbox" value="3" name="0" id="p0"> Algeria</li>
                <li><input type="checkbox" value="3" name="0" checked="true" id="p1"> Angola</li>
                <li><input type="checkbox" value="3" name="0" checked="true" id="p2"> Benin</li>
                <li><input type="checkbox" value="3" name="0" checked="true" id="p3"> Botswana</li>
                <li><input type="checkbox" value="3" name="0" checked="true" id="p4"> Burkina Faso</li>
                <li><input type="checkbox" value="3" name="0" id="p5"> Burundi</li>
                <li><input type="checkbox" value="3" name="0" id="p6"> Cameroon</li>
                <li><input type="checkbox" value="3" name="0" id="p7"> Cape Verde</li>
                <li><input type="checkbox" value="3" name="0" id="p8"> Central African Republic</li>
                <input type="checkbox" value="2" name="3" id="p142"> Tuvalu</li>
                <li><input type="checkbox" value="2" name="3" id="p143"> Vanuatu</li>
                <li><input type="checkbox" value="2" name="3" id="p144"> Wallis and Futuna</li>
            </div>                
        </div>

I would like to:
– I Expect to get in an array all the inputs id (p143,p144) in an array using the name attribute (3 in this case).

  • Then I would like to remove the LI elements that contains that inputs. I know that if I get the input elemens by a CSS Selector I would do it using $”CSSSELECTOR”.parent().remove();

And in a final stage, how to do the change to that CSS Selector to get only the Checked=True using the name again (I want again the IDs).

For the second I´m trying something like:

jQuery("ul#countrySelector > li > checkbox[name=\"" + index + "\"]").parent("li").remove();

Where index is the 0 or 3 in this case, but it doesn´t work.

I don´t need the full solution, and explanation would be better to start thinking in css selectors.

Thanks.

SOLVED.

The HTML was not right because I copy it bad, it is generate by other events.

I only mark as correct the first answer (Wirey) because the others use EACH method and I think that the performance of Wirey solution is the best, and this HTML is just a part of all the generate code in a few levels.

  • 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-15T14:47:36+00:00Added an answer on June 15, 2026 at 2:47 pm

    Once you fix your markup with the missing <li> and </ul>..

    First issue is your selector

    jQuery("ul#countrySelector > li > checkbox[name=\"" + index + "\"]")
    // it says starting from ul with id=countrySelector > find children element li > find children element checkbox
    

    It’s not a checkbox element but an input element of type checkbox so what you need is

    jQuery("ul#countrySelector > li > input[type=checkbox][name=\"" + index + "\"]")
    // or just jQuery("ul#countrySelector > li > input[name=\"" + index + "\"]") if these are the only elements with that name
    

    You state that you want an array with those elements ids. So you can use jQuery’s .map() function to return that in a collection then .get() to get an array

    var ids = jQuery("ul#countrySelector > li > input[type=checkbox][name=\"" + index + "\"]").map(function(){
        return this.id;
    }).get(); // <-- use get() to get id's back as an array - now ids contains all the id's in an array
    

    If you wanted to get only checked items, you can use the :checked selector to get only checked inputs

    jQuery("ul#countrySelector > li > input[type=checkbox][name=\"" + index + "\"]:checked")
    

    Once you get your selector, you can just find your li just like in your example and remove

    $(yourselector).parent('li').remove();
    // or if it's nested deeper $(yourselector).closest('li').remove();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the next code HTML <section class=listjobs style=display: block;> <div class=jobgroup GigaLab>GigaLab</div> <div
I have the following HTML: <div class=wrapper> <div class=label> foor bar baz </div> <img
Let's say I have this HTML: <textarea>blah</textarea> <br> <div class=select_this>hello!</div> How can I select
I have two HTML tables in div s floated next to each other. The
I have a html file like following: <form action=/2811457/follow?gsid=3_5bce9b871484d3af90c89f37 method=post> <div> <a href=/2811457/follow?page=2&amp;gsid=3_5bce9b871484d3af90c89f37>next_page</a> &nbsp;<input
I have next html: <label for="user_name"> <abbr title="required">*</abbr> Name </label> And I want to
I have HTML Content which was being displayed in a UITextView . The next
Okay, next PHPExcel question. I have an HTML form that users fill out and
I have next code, <form id=form1 runat=server> <asp:Label runat=server ID=Label1 EnableViewState=false /> <asp:CheckBox runat=server
I have next form and some ashx <form action=FileUpload.ashx method=POST enctype=multipart/form-data id=frmUpload> <input id=fileupload

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.