jQuery selector not working for



  • Hi
    Trying to close ‘Spliter side’ with button click.

    <ons-splitter-side id="menu" side="left" width="120px" animation='push' collapse  swipeable>
    

    This works:

    var menu = document.getElementById('menu');
          menu.close();
    

    This does not work:

      $('#menu').close();
    

    I get error “Uncaught TypeError: menu.close is not a function”
    Other jquery commands are working.
    What could be the reason?


  • Onsen UI

    @Zeni close is a method of the element itself, not of the jQuery wrapper. Try $('#menu')[0].close();.



  • @Fran-Diox

    Hi
    Thanks Fran, it solved my problem. You are Guru!!.


Log in to reply