Solved

jQuery Simple Photo Manager

Posted on 2009-05-05
2
2,349 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
Comment Utility
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
Comment Utility
Awesome! thanks alot.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now