jquery ui - Dynamically change the handle option in the stop event -


all,i knew how use handle in jquery ui draggable , sortable. , knew can modify dragged item html content , css style in stop event. don't know if there possibility dynamically add handle selector drag item in stop event? please review below code . thanks.

$( ".selector" ).draggable({   connecttosortable : '.sortablediv',    stop: function( event, ui ) {       //do nothing    } });  $(".sortablediv").sortable({   stop:function(event,ui){     $(ui.item).prependto(          $('<div>drag handler</div>').addclass('draghandler'));//append elements       //next want make div.draghandler drag handle .    } }); 

i found way make it. add handle option no matter whether selector can retrieve elements it. if doesn't find element there no handle drag . otherwise works. please review code. thanks.

$(".sortablediv").sortable({   stop:function(event,ui){     $(ui.item).prependto(          $('<div>drag handler</div>').addclass('draghandler'));//append elements       //next want make div.draghandler drag handle .    },   handle:'div.draghangler' }); 

that means handle selector can works on future elements.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -