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');

    This does not work:


    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

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

Log in to reply