In this fiddle – http://jsfiddle.net/adrianjsfiddlenetuser/zyUkd/35/ I’m attempting to remove the draggable functionality of all divs that are styled with .myDivs when the button ‘Remove Draggable’ is clicked.
The function call $('.myDivs').draggable('disable'); does not seem to achieve this ?
First of all, your
clickhandler is made out of a$(document).ready()function, which means that it can be attached even if the DOM isn’t totally loaded. Then, you didn’t make the elements draggable withdraggablebut withsortable, so you should use$(elements).sortable('disable'):Your updated JSFiddle here: http://jsfiddle.net/zyUkd/38/