I am working with a dashboard of divs and each div it has a tree of which the buttons are. Every time I have to know which the id of that div is so I am using parent() alot.
Mostly I am doing $(this).parent().parent().parent()
to find the ID of div so I can set variables to it. The app is based on the id's of each div.
Is it consider slow to use parent() up to 3 times but pretty much on every function?
Is there any other alternative?
I am looking for something like benchmarks-style which shows what's faster.
Here is an example of the tree:
<div id="6179827893" class="dashdiv">
<div class="buttons">
<li><a href="#" class="btn1">Button 1</a></li>
<li><a href="#" class="btn2">Button 2</a></li>
<li><a href="#" class="btn3">Button 3</a></li>
<li><a href="#" class="btn4">Button 4</a></li>
<li><a href="#" class="btn5">Button 5</a></li>
<li><a href="#" class="btn6">Button 6</a></li>
</div>
<div class="dashcontent">
....
</div>
</div>