I\'m working on an app that will present surveys to the user. The markup looks something like this:
You should be able to create a reference to your survey before you iterate over the questions.
function Survey() {
this.questions = new Array();
var survey = this;
$('.question').each(function(i) {
survey.questions.push(new Question(this));
});
}
function Question(element) {
this.element = $(element);
}
var survey = new Survey();
$.each(survey.questions, function() {
$("ul").append("- " + this.element.text() + "
");
});
Working example on jsfiddle