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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:29:48+00:00 2026-05-27T17:29:48+00:00

I have some checkboxes. When I select one of them I need to add

  • 0

I have some checkboxes. When I select one of them I need to add a new element to a list.

I have implemented a change function in jQuery. When I select a checkbox, it adds the element in the list like I want, but when I unselect it, it doesn’t remove the element.

The list id is sumary and the checkbox and the element in the list have the same attribute name.

To remove I have tried this but it doesn’t work:

$("#sumary").find("li[name=$(this).attr('name')]").remove();

If I hardcode a value for $(this).attr('name') it works so the problem is with this:

$(this).attr('name')

What is the solution?

  • 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-27T17:29:49+00:00Added an answer on May 27, 2026 at 5:29 pm

    Javascript doesn’t parse variables within strings, so you’ll want to concatenate the variable into it. Try:

    $("#sumary").find("li[name='" + $(this).attr('name') + "']").remove();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom list with some columns in sharePoint, that one of them
I have a collection of checkboxes with generated ids and some of them have
I need some guidance on how to add a validation method to the jquery
if i have one form that include some input, textarea, select, and multiple file.
I have a form which contains some checkboxes and in one of the checkboxes,
I have a list of checkboxes grouped into sections. Some of these checkboxes can
I have few checkboxes , out of which one is Select All and the
I have some checkboxes bound to an array in my model. This works great,
I have some checkboxes like this: <input type=checkbox name=regions[] value=north-east />North East<br /> <input
I have a page with some checkboxes and a submit button. I use AJAX

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.