Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
jQuery selector not working for
Zeni last edited by Zeni
Trying to close ‘Spliter side’ with button click.
<ons-splitter-side id="menu" side="left" width="120px" animation='push' collapse swipeable>
var menu = document.getElementById('menu'); menu.close();
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?
closeis a method of the element itself, not of the jQuery wrapper. Try
Zeni last edited by
Thanks Fran, it solved my problem. You are Guru!!.
larabrian last edited by
Uncaught TypeError is usually caused because scripts are loaded in the wrong order . The browser will execute the scripts in the order it finds them. If in a script you attempt to access an element that hasn’t been reached yet then you will get an error. Make sure that you don’t have a script above one that it requires.
Sometimes this warning may also be shown if jQuery is declared more than once in your code. The second jQuery declaration prevents bootstrap.js from working correctly. The problem is due to having jQuery instances more than one time. Take care if you are using many files with multiples instance of jQuery. Just leave one instance of jQuery and your code will work.