Solved

jQuery Simple Photo Manager

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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
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…

749 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