Solved

delete item from list with a delete icon

Posted on 2010-08-19
4
375 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
This article discusses how to create an extensible mechanism for linked drop downs.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

806 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