I have a draggable event set up like such:
$(ids.label).draggable({
containment: ids.wrapper,
revertDuration: 100,
revert: function(event) {
$(this).data("draggable").originalPosition = {
top: $(this).data('origionalTop'),
left: $(this).data('origionalLeft'),
}
return !event;
},
...
Now, I want to be able to call the revert function externally in another function. How can this be done? Heres kind of what I am trying to do (which currently does not work):
$(ids.label).each(function() {
for(var iter = 0; iter < wrong.length; ++ iter) {
if($(this).html() == wrong[iter]) {
// Something along these lines.
$(this).draggable.revert(); // This is the line in question
}
}
});
Thanks!
I am not entirely sure why you would need to call that externally. But this might help:
Instead of:
Try: