Gleiemeister 2000 Gleiemeister 2000 - 11 months ago 73
jQuery Question

jquery draggable enable and disable

Ive tried anything to do this, but always get the same error


Error: cannot call methods on draggable prior to initialization; attempted to call method 'disable'

Prior to initialization? So I cannot remove the option before its actually being dragged around? Ive tried with droppable as well, cant seem to get them disabled enabled without getting this error.

I found out that I have an element with the class that is without draggable (which makes sense when you look at the error). Now I just have to find a way so it disables all the draggables without throwing the error :)

Answer Source

Try this:

$(".tooltip").draggable({ disabled: true });

This initializes the draggable in the disabled state. You can then use


later when you want to allow dragging.