I am using jQuery 1.4.5 on my page and use the loader ahead of an ajax request:
$.mobile.loading('show', {theme:"e", text:"", textonly:false, textVisible: false});
After finishing the request, I hide it:
$.mobile.loading('hide');
That works, but it produces an tag at the end of the page where the text would be located.
<div class="ui-loader ui-corner-all ui-body-e ui-loader-default">
<span class="ui-icon-loading"></span>
<h1></h1>
</div>
Several SEO tools are now issuing a warning due to this second h1 tag.
How can I remove the tag from the loader?
3
Answers
You can remove the needed element with the jQuery
remove
method.From jQuery documentation:
I am always a little bit too late to the party, but if You need to customize the JQM loader, please be aware that, near the options described in Your question, You can supply also the
html
parameter.First of all, You need to set Your custom
html
without the unwantedh1
tag during JQM initialization:After that, You can show the
loader
as-is without any text message or – when You need anyway to show a loadingmessage
– You can customize it further, always by using thehtml
option:Please note:
The standard
textVisible
option will not work anymore this way, because by default JQM is searching for theh1
tag which doesn’t exist anymore inside the loader markup. This shall be fixed inside JQM source code, with something that allows a more flexible configuration, without hard-coding theh1
tag: