Question

I want to disable jquery sortable on page load but not sure, someone direct me in right direction please,

In jquery I can do it like this $(".myList").sortable('disable');

Scenario

I have a checkbox based on which I am enabling and disabling jquery sortable for a list, now I can use $(document).ready(function() { and $(checkbox).change(function() { to disable and enable dragging but I can't check it on page load in code behind as checkbox is getting its value from database on pageload.

Was it helpful?

Solution

$(document).ready(function() { 
        if ($('#chcekbox).is(':checked')) {
        $(".myList").sortable('enable');
    } else {
        $(".myList").sortable('disable');
    }  
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top