user3053234
user3053234

Reputation: 385

Jquery mobile changing text for data-add-back-btn="true" from javascript or jquery?

I'm working in Jquery Mobile, and I've got a page which has a back button with this attribute:

data-add-back-btn="true"

I need to be able to change the text of it dynamically through either jquery or javascript. I've googled it quite a bit but not much luck.

Upvotes: 0

Views: 404

Answers (1)

ezanker
ezanker

Reputation: 24738

DEMO

$(document).on("pageinit", "#page2", function(){
    $("a[data-rel=back] .ui-btn-text").html('my text');

});

In jQM markup added for the back button, you select a span with class ui-btn-text that is the child of an A tag with data-rel=back, and then change its html.

Upvotes: 2

Related Questions