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.

Cannot change content with javascript



  • I’m using onsen ui version 1, followed https://onsen.io/v1/guide.html to make changes to DOM

    This section to be exact

    // Add another Onsen UI element
        var content = document.getElementById("my-content");
        content.innerHTML="<ons-button>Another Button</ons-button>";
        ons.compile(content);
    

    The problem is nothing changed on the page.

    If i dump “content” variable or dump the HTML element it shows the newly edited version on browser console. but on page still the old one.

    ons object is instantiated.



  • @Broo0d Can you use version 2? It’s a lot easier to work with.