i am trying not to repeat the selector and get to its children via a the same objects parentElment
declared variable.
I tried:
testimonialsBelt={
parentElment:$(".testimonialsCntnr ul"),
childrenElem:this.parentElment.children().length
}
I also tried:
testimonialsBelt={
parentElment:$(".testimonialsCntnr ul"),
childrenElem:$("testimonialsBelt.parentElment").children().length
}
but i keep on getting a undefined
when calling alert(testimonialsBelt.childrenElem)
.
- is there anyway to get the jquery object with object literals?
- What is the rule? when can i use
this
and when must i have the full path? (in this casetestimonialsBelt.parentElment
).
i am trying to have all these variables in one object called testimonialsBelt. i know i can do this with loose javaScript. Thanks