objects = $(".text"); objects.each(function (index) { this.data("someClass", new objClass(index)).data("someClass").move(); }