Ive tried anything to do this, but always get the same error
$(\".tooltip\").draggable(\'disable\');
Error: cannot call methods on draggabl
I was able to recreate your scenario in this jsfiddle:
http://jsfiddle.net/dboots/NDZKY/
This is using
$('.draggable').draggable('disable');
and
$('.draggable').draggable('enable');
Is there something different that you're not able to do the same? Looks like you have the same syntax.
Use one button to enable and disable
$("#container").draggable({disabled:false});
$("#container").draggable({disabled:true});
Simple Example Given Below:
<div id = "container"></div>
<button id = "control"></button>
<script>
$(document).ready(function()
{
$("#control").click(function()
{
if($("#control").hasClass("active")
{
$("container").draggable({disabled:true});
$("control").removeAttr("class","active");
}
else
{
$("container").draggable({disabled:false});
$("control").attr("class","active");
}
});
});
</script>
Take a look at the documentation http://api.jqueryui.com/draggable/
and a example here:
http://jqueryui.com/draggable/
Have you "included" jquery-ui.js library?
try on this fiddle! http://jsfiddle.net/3Lrg2/23/
Try this:
$(".tooltip").draggable({ disabled: true });
This initializes the draggable in the disabled state. You can then use
$(".tooltip").draggable("enable");
later when you want to allow dragging.
try using .unbind('ondrag') to remove the event from your element.
sorry I think it should be $("tooltip").unbind('draggable') not 100% sure on event name.