I'm creating a custom step.js application for my project. I'm getting error on object scope. Below is my code
var STEPPED = {
el: {
stepContentDiv: $('#stepContent'),
stepNavDiv: $('#stepNav'),
stepNavLi: $('#stepNav li'),
stepNavAnchor: $('#stepNav li a'),
stepNavDone: $('#stepNav li a'),
stepNavActive: $('#stepNav li a')
},
doActive: function(){
this.el.stepNavDone.on('click', function(){
this.el.stepNavLi.each(function(){
alert();
});
});
},
init: function(){
this.doActive();
}
}
STEPPED.init();
Getting error when I run this
this.el.stepNavLi.each(function(){
alert();
});
Uncaught TypeError: Cannot read property 'stepNavLi' of undefined
Can anyone pleas help me what is the issue here? Thanks in advance