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

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

node.js - Express and Redis - If session exists for this user, don't allow access -