user4756836 user4756836 - 1 year ago 156
jQuery Question

Make list undraggable on button click Sortable.js

I am using this plugin:

I want to make the list undraggable when the user clicks the button. From the github page, it seems that I can use

to do so but how do I make it work on button click?

I have tried:

Sortable.create(simpleList, {
$('#button').click(function () {
disable: true,

But it makes the undraggable to begin with.

Non-working Demo:

Working Demo:

Answer Source

If you go with the instructions in the readme, you should get something along the lines of:

var sortable = Sortable.create(simpleList, {});
$("#button").click(function () {
    sortable.option("disabled", true);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download