I have got the following code :
<ul>
<li class="jstree-leaf" kids="0" range="5-7" name="mars" public_id="mars_05" ra_depth="5">
<a href="#"><ins class="jstree-icon"> </ins>mars</a>
</li>
<li class="jstree-leaf" kids="0" range="8-10" name="pluto" public_id="pluto_8" ra_depth="5">
<a href="#"><ins class="jstree-icon"> </ins>pluto</a>
</li>
</ul>
I need to get the ra_depth attribute value of a particular <li> by using it’s name attribute value.
I tried the code below but it’s not working:
alert(li[name='"+myarray[0]+"'].attr("ra_depth"));
myarray[0] contains the value “pluto”.
Is there anything I am missing?
Description
You forget
$(in your selector. Check out my sample and this jsFiddle DemonstrationSample