Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

jQuery Mobile Loader html Option

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops.

In this article, we will be using the jQuery Mobile Loader html Option to replace the entirety of the loader’s inner html.

Syntax:

Initialize the loader with the html option specified:

$( ".selector" ).loader({
 html: "<span class='ui-icon ui-icon-loading'><img src='jquery-logo.png' /><h2>is loading for you ...</h2></span>"
});
  • Get the html option:

    var html = $( ".selector" ).loader( "option", "html" );
  • Set the html option:

    $( ".selector" ).loader( "option", "html", "<span class='ui-icon ui-icon-loading'><img src='jquery-logo.png' />
    <h2>is loading for you ...</h2></span>" );

CDN Links: Add the below jQuery Mobile scripts that will be needed for your project.

<link rel=”stylesheet” href=”//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.css”>
<script src=”//code.jquery.com/jquery-3.2.1.min.js”></script>
<script src=”//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.js”></script>

Example: This example demonstrates the jQuery Mobile Loader html Option.

HTML




<!doctype html>
<html lang="en">
      
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1">
    <link rel="stylesheet" 
          href=
"//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.css">
    <script src=
"//code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src=
"//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.js">
    </script>
      
</head>
  
<body>
    <center>
        <div data-role="page" id="page1">
            <div data-role="header">
                <h1 style="color:green;">GeeksforGeeks</h1>
                <h3>
                    jQuery Mobile Loader html Option
                </h3>
            </div>
            <div role="main" class="ui-content">
                <div data-role="controlgroup">
                  <button class="show" data-theme="b" 
                          data-textvisible="true" 
                          data-html="<span class='ui-bar ui-overlay-a ui-corner-all'
                                     style='width:300px; height:100px'>
                         <img src=
                         <h2>is loading for you ...</h2></span>" data-iconpos="right">
                         Custom HTML</button>
                </div>
            </div>
        </div>
    </center>
      
    <script>
        $(document).on( "click", ".show", function() {
          var $this = $( this );
        $.mobile.loading( 'show', {
          textVisible: $this.jqmData( "textvisible" ) || 
          $.mobile.loader.prototype.options.textVisible,
          html: $this.jqmData( "html" ) || ""
          });
        })
        ;
    </script>
</body>
</html>

Output:

jQuery Mobile Loader html Option

jQuery Mobile Loader html Option

Reference: https://api.jquerymobile.com/loader/#option-html


My Personal Notes arrow_drop_up
Last Updated : 07 Feb, 2022
Like Article
Save Article
Similar Reads
Related Tutorials