i am currently use Draggable in Jquery i am trying to make it so when you click on a div it will disable you from draging it i have the follow code be it seems to not work can anyone lead me in the right direction please
selected_div = $("input#selected_div").val();
$("#68").draggable({
containment: 'parent',
if(selected_div == 68){
disabled: true,
}else{
disabled: false,
}
handle: 'drag_border',
drag: function(e, ui) {
var top = ui.position.top;
var left = ui.position.left;
$("input#tuPBd0hm_top").val(top);
$("input#tuPBd0hm_left").val(left);
$("#top").html(top);
$("#left").html(left);
}
});
Thank you,
try this:
And if you want to be able to disable or enable the div from being draggable after the page has been loaded then look at jquery Draggable API and click the Methods tab
I hope this helps!