Solved

jQuery Simple Photo Manager

Posted on 2009-05-05
2
2,351 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
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)

813 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

18 Experts available now in Live!

Get 1:1 Help Now