Update button text in JQuery Mobile

jQuery Logo

In case you wondered how it is possible to update the text of a <button> element created by markup in jQuery mobile (i.e. not a button generated using <a data-type=”button”>) you need to set the text and then call refresh on the node:

$('#someButton').text("Updated text");
$("#someButton").button("refresh");

refresh() actually causes the node to be reloaded, thus reflecting your changes.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.