how to change a button text in jQuery mobile

button, javascript, jquery-mobile, text

Solution

I've had to do the same thing before, it's really not as obvious to do as it should be. Since jQM adds `span` tags inside your button, you need to change the value inside the span:

$("#login_var .ui-btn-text").text("NewText");

Similarly, if you wanted to change the icon, you could do:

$("#login_var .ui-icon").removeClass("ui-icon-arrow-l").addClass("ui-icon-arrow-r");

Edit: Sorry I just noticed the link you posted in the question has the same solution, and you said that doesn't work for you. Maybe if you changed your buttons to

<a data-role="button"></a>

Instead of `<button></button>`?

Problem

Possible Duplicate: change text on button using jquery mobile. I need to change a button text, I am using jQuery mobile. Here is my html: ``` <fieldset> <div><button type="submit" id="login_var">Login</button></div> <div><button type="reset" >Reset</button></div> </fieldset> ``` I have tried all of the examples on this page: LINK and nothing is working for me. Please help

Original source

Related problems