最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery sortable enable - Stack Overflow

programmeradmin1浏览0评论

I'm disabling dragging on jquery sortable list but not sure how to enable it back, can someone point me in direction please,

$(".anotherClass").sortable('disable'); //it disables it

I can't seem to find anything in documentation.

This question says enable input here but its not working

$("#wantedItems").sortable({
    receive: function (event, ui) {
        //enable the input here  which input ???????????????????????????????
    }
});

I'm disabling dragging on jquery sortable list but not sure how to enable it back, can someone point me in direction please,

$(".anotherClass").sortable('disable'); //it disables it

I can't seem to find anything in documentation.

This question says enable input here but its not working

$("#wantedItems").sortable({
    receive: function (event, ui) {
        //enable the input here  which input ???????????????????????????????
    }
});
Share Improve this question edited Dec 29, 2017 at 7:26 KARTHIKEYAN.A 20.2k10 gold badges137 silver badges150 bronze badges asked Mar 5, 2013 at 14:28 MathematicsMathematics 7,62826 gold badges82 silver badges161 bronze badges 1
  • Just to clarify, you want to enable $(".anotherClass").sortable()? – Dom Commented Mar 5, 2013 at 14:30
Add a ment  | 

4 Answers 4

Reset to default 4

You just call it with 'enable'

$( ".selector" ).sortable( "enable" );

Documentation for method: http://api.jqueryui./sortable/#method-enable

simply write.....

$(".anotherClass").sortable()

enable()

Enables the sortable.

  • This method does not accept any arguments.

Code examples:
Invoke the enable method:

$( ".selector" ).sortable( "enable" );

Link: http://api.jqueryui./sortable/#method-enable

To enable sortable() again you can use

$(".anotherClass").sortable("enable");

To toggle enable/disable on the click of a button with id toggleButton

$('#toggleButton').click(function() {
    //check if sortable() is enabled and change and change state accordingly
  // Getter
  var disabled = $(".anotherClass").sortable( "option", "disabled" );
  if (disabled) {
    $(".anotherClass").sortable( "enable" );
  }
  else {
    $(".anotherClass").sortable("disable");
  }
});
发布评论

评论列表(0)

  1. 暂无评论