In JavaScript, this is how you check if a class exists on a page:
var isClassExist = document.getElementsByClassName('yourClass'); if (isClassExist .length > 0) {
And here is how you add the css file to the page:
var cssId = 'myCss'; // you could encode the css path itself to generate id.. if (!document.getElementById(cssId)) { var head = document.getElementsByTagName('head')[0]; var link = document.createElement('link'); link.id = cssId; link.rel = 'stylesheet'; link.type = 'text/css'; link.href = 'http://website.com/css/stylesheet.css'; link.media = 'all'; head.appendChild(link); }
Part of the bootloader:
First you need to enable your counter in html:
<div id="dvReqSpinner" style="display: none;"> <br /> <center><img src="~/images/loading_spinner.gif" /></center> <br /> </div>
Then in JavaScript (using jQuery):
$("#dvReqSpinner").hide();
source share