[jQuery] OOP's *this* messing up $().each()'s *this*
Confusing title, but whatever. So basically I'm working on my first
OOP script, and I just ran into a bit of trouble while trying to
reiterate over an amount of <td>'s, using each()
function classname() {
var mainvar =new Array("example","array");
this.functionname = function() {
$('td.number').each(function(_i) {
$(this).html(this.mainvar[_i]);
});
}
}
So how would I go about doing this? Is there an alternate way in
Javascript to reference without using this.variable or this.function?
Or is there a jquery solution? I'm really at a loss...