Calling method from options function of jquery widget -



Calling method from options function of jquery widget -

iam creating widget , need method in options (with possibility of calling _somemethod in same widget):

options: { afterload: function (count) { this._somemethod(); } } _somemethod: function(){ }

but "this" in options have context of options. how phone call _somemethod() options method afterload? how widget context on afterload method?

thanks answer.

you need define function ( method ) variable , utilize later in object :

var somemethod = function() { ... }; options: { afterload: function (count) { somemethod(); } } _somemethod: somemethod

by doing assign variable must define within function ( because don't want leak global variables ) , utilize reference in options

jquery jquery-ui

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -