Onsen 2, jQuery, & navigator
-
Any ideas why this method works:
document.getElementById(‘myNavigator’).pushPage(‘details.html’, { animation : ‘slide’ } );But this method:
$("#myNavigator").pushPage(‘details.html’, { animation : ‘slide’ } );Errors out with “Uncaught TypeError: $(…).pushPage is not a function(…)”.
Any ideas?
-
@crankedcode What versions are you working with?
-
@crankedcode Because jQuery does not return the element, it returns a jQuery object that basically is an array of elements with some extra properties. Try
$("#myNavigator")[0].pushPage...
instead.
-
@Fran-Diox said:
@crankedcode Because jQuery does not return the element, it returns a jQuery object that basically is an array of elements with some extra properties. Try
$("#myNavigator")[0].pushPage...
instead.That worked perfectly! Thank you very much for the prompt reply! :)