Response title
This is preview!




What do this and $(this) mean inside a widget method like create?
For example, Having a widget like this,
- $.widget("sample.CustomWidget", {
- options:{
- },
- _create: function(){
- // Here what do this and $(this) mean
- }
- });
Thanks in advance,
-Raja.
I have a jquery widget like this:
$.widget("ui.MyWidget", {
options: {
Value1: 10,
Value1: 20,
},
// and other methods like _create,...
});
And, i am extending it like this: $.widget("ui.MyExtWidget", $.extend({ options: { Value3: 30,
}}, $.ui.MyWidget.prototype, {
myNewMethod: function(){
alert(this.options.Value1+this.options.Value3);
}
}
I have to call the "myNewMethod" in my html.
My html code is like this:
$("#Div1").MyExtWidget();
$("#Div1").MyExtWidget("myNewMethod");
I am getting exception like this while using the above code cannot call methods on TimeSpanHeader prior to initialization; attempted to call method 'myNewMethod'
What is the way to call the "myNewMethod" method?
© 2012 jQuery Foundation
Sponsored by
and others.
