I am trying to pass a variable inside a method of js so that I can get some value as return, example
getId: function (pos) {
var myVar = $('.myDiv li:nth-child(pos) .myInnerDiv .myInnerMostDiv').attr('id');
return myVar;
}
And then call this as
this.getId(6); //where 6 is the pos
However this seems to be not working.
What am I doing wrong here?