Getting ID of image being resized using Jquery UI
I am using Jquery UI to drag and drop and resize images. I am resizing the image within the div and dragging the Div to resolve the bug in Jquery UI if one drags and resizes div.
How do I find the div ID of the image being resized?
My code is as follows:
$("img").resizable({ handles:'n,e,s,w,ne,se,nw,sw' , maxHeight: 300, aspectRatio: true,
stop: function(event, ui) { alert( // want to send div ID of the image);} });
HTML code
<div id="pic1" style="float:left"> <img src="im开发者_JAVA技巧age source" height="150"></div>
I already tried unsuccessfully to get div ID of the image
1. using ui.originalElement[0].attr('id'), ui.originalElement.attr('id') 2. using event.trigger.idThis should give you what you were after
$(this).parent().attr('id')
精彩评论