How can I dynamically add a navbar to my jquery mobile application? From javascript I want to be able to add the navbar elements to the dom and then have them parsed.
I found that I could add the element to the DOM however I wanted, and then call .navbar() on the element and it would perform the navbar parsing.
For instance I could use
var myNavBar = $('div', {
'data-role':'navbar',
'html':'<ul><li><a id="some">First</a></li></ul>'
}).appendTo(myPage).navbar();
Use this code after appending HTML code using DOM:
$("div[data-role='navbar']").navbar();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With