user1434739
user1434739

Reputation: 235

Create a JQM Custom Loading Message

I have a working Jquery Mobile loading message below:

$.mobile.showPageLoadingMsg("a", "Fetching Operators");

however I wish to do this,

$.mobile.showPageLoadingMsg("a", "<div class='clearfix'>Fetching Operators</div><a href='default.aspx'>Use Simple Site</a>");

so that if the user has a slow conn they can opt to click the link to the simply site.

The HTML however does not render, but rather all just shows as text. Can anyone tell me how to achieve the above?

Thanks very much for the assistance.

Regards Devin

Upvotes: 2

Views: 582

Answers (1)

Jasper
Jasper

Reputation: 76003

It looks like jQuery Mobile does not allow HTML to be used by default (the .text() method is most likely used internally rather than the .html() method), and it also looks like each time you call the $.mobile.loading() method (the new version of the method you're running) that the text for the loader gets reset.

Here's a quick (dirty) solution for jQuery Mobile 1.2:

//show the loader, specifying to show the text message
$.mobile.loading( 'show', { textVisible : true } );

//now find the loader widget, find the text within it, and then set it's HTML
$("body").find(".ui-loader").find("h1").html("<div class='clearfix'>Fetching Operators</div><a href='default.aspx'>Use Simple Site</a>");

Here is a demo: http://jsfiddle.net/nABCq/

Upvotes: 1

Related Questions