jqueryhtmlcordovanavbarjquery-mobile-navbar

how can i dynamically set navbar tab text?


i want set names of each tab dynamically using script. I don't know the exact way to do this kindly help me out?Here are my tabs i need to set names dynaically

here is html code:

            <div data-theme="a" data-role="footer" data-position="fixed" data-tap-toggle="false">
            <div class="myNavBar" data-role="navbar" data-iconpos="top" >
                <ul>
                    <li >
                        <a href="#"  id="home_icon"  data-transition="pop" data-theme="a" data-icon="custom" class="ui-btn-active ui-state-persist" >
                            Home
                        </a>
                    </li>
                    <li >
                        <a href="favourites.html"  id="fav_icon" data-transition="pop" data-theme="a" data-icon="custom" >
                            Favorites
                        </a>
                    </li>
                    <li>
                        <a href="Recents.html" id="recent_icon" data-transition="pop" data-theme="a" data-icon="custom" >
                            Offers
                        </a>
                    </li>
                    <li>
                        <a href="Settings.html" id="setting_icon" data-transition="pop" data-theme="a" data-icon="custom" >
                            Settings
                        </a>
                    </li>
                </ul>
            </div>
       </div>

Solution

  • All above answered ways are right but, in the above solutions icons of tab hide and only it shows updated text. The right way to do this is $($('.ui-btn-text')[0]).html('testing');. It will change the name of first tab Home to testing.