开发者

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.id


This should give you what you were after

$(this).parent().attr('id')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜