Getting ID of a cloned element

Posted by Haris on Stack Overflow See other posts from Stack Overflow or by Haris
Published on 2010-04-19T10:35:31Z Indexed on 2010/04/19 12:03 UTC
Read the original article Hit count: 234

Filed under:
|

I'm using jQuery draggable and droppable. I'm cloning the draggable widget on drop event of droppable.

I want to fetch the ID of the cloned element which will be sent to the the application with the AJAX request. I'm unable to fetch the ID. console.log returns blank string.

var dropElem = ui.draggable.html();
var clone = $(dropElem).clone();
var widgetType = $(clone).attr('id');
$(this).append(clone);

Also, I want to change the ID of the cloned element on the response event of the ajax request. How do I specially change the ID of the cloned event after it has been appended?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui