Solved

delete item from list with a delete icon

Posted on 2010-08-19
4
377 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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…

734 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