You have to get the execution order right.
this is just a declaration, to let javascript know that this function
exists
MyClass.prototype.init = function (){
this.imagesHolder = jQuery("#imgs");
}
jQuery("#imgs") is not executed until you do something like this.
var
Yep, I intend to use myClass outside of document ready.
I thought that in order to use jQuery as follows
this.imagesHolder = jQuery("#imgs");
inside of MyClass I would have to enclose it inside
$(document).ready(function(){...
so that DOM is ready before invoking MyClass.
Is my assumption wrong?
Looks fine to me.
Is myClass used in other places (ie outside of your document ready)?
If so, you have to define it outside of document ready or do this
window.myClass = function() {
this.imagesHolder = null;
}
On Dec 29, 7:09 pm, bob wrote:
> Is that a correct way to create class utilizing
3 matches
Mail list logo