jQuery Simple Photo Manager

I am using the "Simple Photo Manager" sample of jQuery, the example is here:


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.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

alien109Connect With a Mentor Commented:
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')) {
} else if ($target.is('a.ui-icon-zoomin')) {

and add the code before the deleteImage call.
aeg1sAuthor Commented:
Awesome! thanks alot.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.