I have a draggable element that is dynamically generated by jQuery. I have a background image within the div. How can I bind the element so it never goes outside the div?
Here's the code: jsfiddle.net.
$(document).ready(function () {
$("button").click(function () {
$("#currentimage").append('<img id="dragable" src="http://s25.postimg.org/pi8ruls3z/image.jpg" width="200px" height="auto" />');
$("#dragable").draggable();
});
});