html5 - Jquery draggable object start and stop events is not getting triggered -


pfb code. here able trigger stop event using below code.

$(function () {       $("#drag").draggable({                 stop: function (event, ui)                 {                     var = "avinash";                 }             });     }); } 

but using below code not able trigger stop event.

$(function () {          $("#drag").draggable({             stop: this.handledragstop         });     });      function handledragstop(event, ui) {         debugger;     } } 

i did not understood missing here.

please me on this.

firstly, have additional incorrect bracket in second approach. secondly, approach doesn't work you, because you're using immediate function, creates new scope , 'this' not related "handledragstop" scope (in case it's global scope). should move handledragstop function inside immediate function, or use handledragstop without 'this'.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -