You must Sign In to post a response.
  • Category: JQuery

    Enable and disable items in menu using jquery

    Hi in my application there is a menu.

    following is the menu

    <div id='jqxMenu'>
    <ul>

    <li>About Us
    <ul>
    <li><a href="#">History</a></li>
    <li><a href="#">Our Vision</a></li>
    </ul>
    </li>
    <li id="account" >Accounts
    <ul>
    <li ><a id="cpv">CashPaymentVoucher</a></li>
    <li ><a id="cv" >CashReceiptVoucher</a></li>
    </ul>
    </li>

    </ul>
    </div>

    I want to display the menu items as per some condition

    If permission=0 menu should be hide

    if it is 1 menu should display no menu items

    in this case only about us and accounts should display.no need to display child elements

    if it is 2 menu and its child elements should display and child elements should be deactivated.

    if it is 3 menu and child elements should display and child elements should be activated.

    how it is possible using jquery.


    Regards

    Baiju
  • #761235
    You can try "each()" jquery

    $( document.body ).click(function() {
    $( "li" ).each(function( index ) {
    // console.log( index + ": " + $( this ).text() );
    // you can use your disable logic
    });
    });

    By Nathan
    Direction is important than speed


  • Sign In to post your comments