Monaca Onsen UI Discord Chat Github Repo

Dynamically changing spans with jQuery only works on inital page?

  • My app is setup using splitter. Inside splitter, I have the navigation. I noticed when trying to dynamically change contents of span using jQuery (Example: $("#mySpan").text(“new text”); ), this will only work for the first page that is initially loaded. It seems to not work with any other ons-template that is not displayed initally. I’m getting no errors reported in console. Any ideas?

    Edit: grammar

  • I was successfully able to update the span using callback property of pushPage function. However, is there a way to force these pages to update no matter the position in the stack?

  • Onsen UI

    @crankedcode That’s the thing, they are not even in the stack because you didn’t create them yet. They are just templates. There is a moment when the page is created and attached but not visible. You can do changes there. It’s called page’s init event.