Just curious about jQuery/Javascript and referring to options within variables.
So, I wrote a little plugin that when I call "populate" will fill in some text. Very basic. Here's what I'm trying to do:
var foo = {
msg1: "Hey",
msg2: this.msg1 + "how",
msg3: this.msg2 + "are",
msg4: this.msg3 + "you",
msg5: this.msg4 + "doing",
msg6: this.msg5 + "today"
}
$("#bar").populate({text: foo.msg6});
So when the .populate plugin is called, #bar will get "Hey how are you doing today" added to it.
The populate plugin is hard to explain but trust me it's working great and not the issue. I'm just curious if this sort of organization of variables and options is possible, as it seems cleaner, more "semantic", and more organized to me than just a bunch of variables referring to other variables...