Is .closest() a javascript or a jQuery object?

Up until last week, the event target was a div.no_style_elearning_dropped_multiple_answer but suddenly it is now an img

So my old if statement no longer works:

if ($(event.target).is(“div.no_style_elearning_dropped_multiple_answer”)) {

I’m trying to replace it with the following if statement:

var droppedObj = $(event.target).closest(“div.no_style_elearning_dropped_multiple_answer”)[0];
if (droppedObj.className.indexOf(‘no_style_elearning_dropped_multiple_answer’) != -1) {

It works fine but then the droppedObj does not give me access any more to the attribute elearningAnswerId

The following variable is undefined:

var elearningAnswerId = droppedObj.attr(“elearningAnswerId”);

Note that the element is dynamically added by:

var droppedContent = “<div class=‘elearning_question_answer no_style_elearning_dropped_multiple_answer’ elearningAnswerId='” + ui.draggable.attr(“elearningAnswerId”) + “'>” + trim(ui.draggable.html()) + “</div>”;

Is the droppedObj object a javascript object ? Is that why is doesn’t have the jQuery attribute ?

Thanks for any tip.

Stephane

I solved the issue by wrapping the droppedObj in a $(droppedObj) as in:

var elearningAnswerId = $(droppedObj).attr(“elearningAnswerId”);

So as to turn this DOM object into a jQuery object.