Automatically selects list ID for Toggle

时间:2015-05-08 10:00:12

标签: jquery html

I am trying to select list id automatically using Jquery. When I click on some list it should take its id and allow toggle. Now I want that JQuery automatically gets the ID`` of clicked Item and perform the toggle.

By toggle I mean when I click on Catalog other list items will hide. And only Catalog list will show.

I want to implement below Jquery :

$('#cssmenu li:has(ul) a').on('click', function(e) {
    e.preventDefault();
    if( $(this).hasClass('activeSubmenu') ) {
        $(this).removeClass('activeSubmenu').next('ul').hide();
    }
    else {
        $('.activeSubmenu').removeClass('activeSubmenu').next('ul').hide();
        $(this).addClass('activeSubmenu').next('ul').show();
    }
});

*

<ul ng-repeat="codes in response">
  <li ng-if="((codes.branch == formData.branches.alias) && (codes.taken == 0))">
    <strong>{{codes.id}}</strong> 
    {{codes.code}}
  </li>
</ul>

1 个答案:

答案 0 :(得分:0)

It may fixe your problem

jconsole

jsFiddle