Search code examples
jquerykendo-uitelerik-mvc

jQuery - Multi Level Selector


<ul id="L1">
    <li id="L1_1"></li>
    <li id="L1_2">
        <ul id="L2">
            <li id="L2_1"></li>            
            <li id="L2_2"></li>
            <li id="L2_3"></li>
            <li id="L2_4"></li>
        </ul>
    </li>
    <li id="L1_3"></li>
</ul>

Can you jquery experts provide me with the selector to select say id="L2_3"?

$("#L2_3") won't work unfortunately due to my specific situation with this 3rd party library I'm working with (Kendo / Telerik / whatever they're calling themselves these days)

Following kinda works but only for one level (I need it to select deeper):

$('[id="L1_1"]'

Solution

  • Given the nature of Kendo Panelbar, I can't simply say:

    panelbar.expand($('[id="L2_4"]'))
    

    to circumnavigate this short coming here's how i'm going to do it:

    panelBar.select($('[id="L1_2"]'));
    var item = panelBar.select();
    panelBar.expand(item);
    
    panelBar.select($('[id="L2_4"]'));
    item = panelBar.select();
    panelBar.expand(item);