What is the best way to update or include a new class in the jQuery mobile loader widget?

After reviewing the documentation at this link:

I discovered a method to modify or add the default class of the loader widget, ui-loader.

Despite my attempts, I have not been able to see any changes. You can view my demo here: https://jsfiddle.net/yusrilmaulidanraji/u1q4xjnt/4/

Am I overlooking something?

Answer №1

Despite attempting all the examples provided in the documentation, I found that the classes option was not having any effect. As a result, I resorted to making changes programmatically using JavaScript. You can view my demo here: https://jsfiddle.net/yusrilmaulidanraji/u1q4xjnt/6/

Here is the code snippet:

<button id="hideLoading"></button>

CSS:

.abv-loading-text{
  width: 100%;
text-align: center;
}


.ui-loader-custom {
    display: block;
    width: 100%;
    left: 0;
    margin: 0 auto;
}

JavaScript:

var loadingUI =
    "<label class='abv-loading-text'>Wait on this screen until the process is complete.</label>" +
    "<span class='ui-icon-loading'></span>" +
    "<h1></h1>";
$.mobile.loading("show", {
  html: loadingUI,
  textVisible: true
});
$(".ui-loader").addClass('ui-loader-custom');



$("#hideLoading").on("click", function () {
    $(".ui-loader").removeClass('ui-loader-custom');
    $.mobile.loading("hide");
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

An unexplained line break is being added to content loaded via ajax requests

When using either .ajax or .load to load content from an .html page and insert it into an element, I am experiencing a strange issue where a mysterious new line is appended after the content. It is not a break element, but more like a \n or \r ch ...

Is there a way to remove a specific object key from a JavaScript object?

One thing I would like to achieve is transforming a JSON structure. Let's start with an example like this: { "de": { "errors.de.i18n.js": { "errors": { "addcreditcard": "Wir konnten diese Karte nicht verifizier ...

Looking to retrieve the name of an article by its ID using asynchronous methods in Symfony 2.8. How can this be accomplished?

Hello everyone, I'm currently seeking a solution to retrieve the name of a product when a user enters the product ID into an input field. Here's what I have tried with JavaScript: function showHint(str) { if (str.length == 13) { $.ajax({ ...

Show a notification every time an SQL update is completed successfully

Utilizing PHP, I am updating the item table by iterating through a result set. while (!$rs->EOF) { $conn->Execute("UPDATE [table] SET qty='".$quantity."' WHERE locn ='".$locn."' AND pdln ='".$pdln."'") ...

Tips for positioning divs on top of an image with Twitter Bootstrap

I'm having an issue with displaying an image and dividing it using bootstrap div columns. The problem is that the image is overlapping the divs, making it impossible to click or attach jQuery events to it. Here is the code I am currently using: #view ...

What happens when absolute positioning looks for "relative" inside nested divs?

I'm struggling to grasp the concept of nested divs and how they work together. I understand that when you have a "position absolute" element inside a "position relative" element, the former looks for the latter as its reference point. But what happens ...

Javascript Rest for y moments

My website's JavaScript function uses AJAX to retrieve account information and open a modal for viewing and editing. Sometimes, the details don't update quickly enough in the database before the function collects them again, leading to discrepanc ...

Issues with making cross-domain requests using jQuery and PHP

I have stumbled upon a similar question that has been asked before, but unfortunately, the answer provided did not give me enough guidance to identify where my code is incorrect. I apologize if this question resembles a previously existing one; I have spen ...

Explore the extensive JSON link for redirecting

I have an issue with accessing the HATEOS link example on PayPal. My browser is showing a syntax error when I try to access the link. SyntaxError: missing ) after argument list [Break On This Error] alert(links.1.href); (line 32, col 15) The JSON d ...

Fetching the jquery variable within an HTML document: A step-by-step guide

Here is the content of my check.js JavaScript file, which includes a function: function fun2(userid) { $.ajax({ type: 'POST', url: 'ex.php', data: {userid: userid}, success: function (data) { ...

Failure to load a picture does not trigger onError in the onLoad function

Is there a way to ensure that an image always loads, even if the initial load fails? I have tried using the following code snippet: <img class="small" src="VTVFile4.jpg" onload="this.onload=null; this.src='VTVFile4.jpg?' + new Date();" alt=" ...

To create a distinctive design, the HTML5 wrapper will specifically enclose the Header element

After using a border, I discovered that my wrapper is only wrapping the header and not extending down to the footer. Can anyone offer some guidance on how to wrap the entire content from the header to the footer? I've come across suggestions to speci ...

Is there a way for me to determine when the modal animation has completed?

I'm currently using the modal feature in twitter-bootstrap and I am curious about how long it takes for the modal to appear before triggering an alert. To better illustrate my point, you can check out this example: HTML <button id="mod" class="b ...

What is the reason for the improper setting of the div position?

Welcome to the interactive Pointer Pin application! The red-bordered box is where you can drop your Pointer Pins. This area has a background image set. The blue-bordered box is where you can drag various Pointer Pins from. These pins can be dropped into ...

Using jQuery to incorporate a variable into JSON schema markup

For my current project, I am attempting to extract the meta description and incorporate it into JSON schema markup. However, I am facing difficulty in passing the variable properly into the JSON structure. My initial approach was as follows: <script&g ...

What causes an "Undefined index" error in jQuery when making AJAX requests?

Whenever I make an AJAX request in my main.js file, I encounter the following error message: Undefined index: id in sqlinfo.php on line 13 I am puzzled because I believe that I am populating the request object correctly. What's even more perplexing i ...

Assign the value selected from a dropdown menu to a PHP variable for MySQL

Is there a way to adjust the variable $Category in the following mysql query based on the selection made in the dropdown list? This seems like a straightforward task, but I'm having trouble figuring it out. It would be really helpful if the page coul ...

PHP and AJAX: Handling the 'Undefined Index' Error

As a newcomer to AJAX, I apologize if the solution is obvious. I need to insert dates into a MySQL table without having to refresh the page, but I'm encountering an issue. The code is throwing the following error: "Notice: Undefined index: post in ...

Ajax login feature not redirecting to login popup after successful login

When attempting to open a popup by clicking on the login window, a pop-up appears with a URL requesting username and password along with Google sign-in. However, when a user tries to log in using Google sign-in through the pop-up, it fails to redirect to ...

AngularJS - Bootstrap Datepicker with custom format 'mm-yyyy' still permits users to input date in 'mm-yy' format

After incorporating the bootstrap datepicker into an angular directive and applying it to a textbox, everything appears to be functioning correctly except for the validation aspect. Although I have configured it to only accept dates in 'mm-yyyy' ...