STYLE SWITCHER

identifying which item is clicked in a multi level list using jquery

jQuery-debouncing-events


<div class="row1">
    <ul>
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
    </ul>
</div>
<div class="row2">
    <ul>
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
    </ul>
</div>
<div class="row3">
     <ul>
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
    </ul>
</div>

var $all_lis = $('li');

$all_lis.on('click', function() {
    var index = $all_lis.index(this);
    alert(index);
});

Website

Recent Article

Leave a Reply

Your email address will not be published. Required fields are marked *