Get attribute of JQuery ui.draggable

Jon picture Jon · Apr 13, 2010 · Viewed 18.4k times · Source

I'm using JqueryUI for drag and drop on one of my pages and for some reason I can't seem to get an attribute of the ui.draggable object being passed into my droppable drop event.

ui.draggable.attr("src") and $(ui.draggable).attr("src") both return undefined, however if I type ui.draggable.html() I will get the html back. Any ideas?

Answer

Jon picture Jon · Apr 14, 2010

I figured it out. The solution is to call ui.draggable.find("img").attr("src"), I just assumed that the ui.draggable object was an image.