Solved

delete item from list with a delete icon

Posted on 2010-08-19
4
376 Views
Last Modified: 2012-05-10
Hi Experts,
I am trying to create a preferences list in a webpage using JQUERY.  The prefrences will be selected by user from a wide range of available preferences(checkboxes).  The selected ones will be displayed in list. I need to let the users delete from the list say by clicking on a delete icon right beside the item in the list. If there are 5 items in the list, each will have its delete button right beside it. Whats the best way/efficient way to implement this? I am assuming that JQuery is pretty compatible across browsers.
Any help is greatly appreciated
0
Comment
Question by:guyneo
  • 2
4 Comments
 
LVL 15

Expert Comment

by:SRigney
ID: 33478006
jquery is compatible across browsers, that's the best thing about it.

I'd say as you click checkboxes you add an item to the list with a delete link specifically for it.  The delete link can have an event set up to delete it.

Do you have a page layout that you are already working with?
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 33478056
take the following approach
1) create the list with delete icon as img tag
<ul>
   <li>
     <img href=''>
   </li>
</ul>

2) put this jquery code after the list is created in DOM
$("ul li img").bind("click", function(){
   $(this).parent().remove();
});

0
 
LVL 1

Author Comment

by:guyneo
ID: 33534605
. Works perfectly.  Thanks for helping out a newbie like me.
 Now I am trying to delete  items from it.
I am posting it as as seperate question so that I can givepoints seperatealy
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 33534701
thanks for the points
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWK: How to strip all double quotes from a file? 7 24
How to make a good PHP + MySQL + JS pagination system? 3 35
Javascript 2 28
Autocomplete with Jquery Question 2 21
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question