I'm creating the script files for my Project using Object Orientation and I also use frameworks/widgets like jQuery and Datatables.
The public properties I create on my class, are not accessible from the inner scope of functions that are executed from jQuery code.
Here is a sample:
function MyClass() {
this.MyProperty = '';
}
MyClass.prototype.initialize = function() {
$(document).ready(function(){
alert(this.MyProperty); // MyProperty is undefined at this point
}
};
How can I fix this? Is this the correct way to have a property that can be accessed from every member of a class?