Solved

jQuery Simple Photo Manager

Posted on 2009-05-05
2
2,352 Views
Last Modified: 2012-05-06
I am using the "Simple Photo Manager" sample of jQuery, the example is here:

http://jqueryui.com/demos/droppable/photo-manager.html

I need to know how to access the "ALT" attribute of the image that is clicked when the trash can icon is clicked.

Thanks in advance for all the help.
0
Comment
Question by:aeg1s
2 Comments
 
LVL 12

Accepted Solution

by:
alien109 earned 500 total points
ID: 24307308
if you look at the deleteImage function, the argument passed to the function is the list item that is clicked. You'll need to find the image that is a child of the list element, and then get it's alt attribute.

Place the following line at the top of the deleteImage function.
var altText = $("img", $item).attr("alt");

This behavior will apply however also when you drag an item to the trash. If you need it to only happen when the icon is clicked:

Look for the lines in the js

if ($target.is('a.ui-icon-trash')) {
    deleteImage($item);
} else if ($target.is('a.ui-icon-zoomin')) {

and add the code before the deleteImage call.
0
 

Author Closing Comment

by:aeg1s
ID: 31578073
Awesome! thanks alot.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
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 the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

840 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