Reputation: 6862
Is there a way to check if twitter-bootstrap
's jquery
plugins are working properly?
Upvotes: 3
Views: 8482
Reputation: 29
How to check in Python and Appium if bootstrap.js is properly loaded and working.
Upvotes: 0
Reputation: 5074
A much better answer is already here: How to check if Twitter Bootstrap is Loaded. If jQuery is also having problems, such as if the "$" character is not defined when you run the code from the link above, or if you want to check if jQuery itself is loading, try here: jQuery is not defined.
Upvotes: 1
Reputation: 197
I ran into this same issue. Here is how I can load bootstrap from the CDN or fail to local.
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/js/bootstrap.min.js"></script>
<script>if ($('body').popover) { document.write('bootstrap loaded from cdn') }
else { document.write('cdn bootstrap failed, going local');
document.write('<script src="js/vendor/bootstrap.min.js"><\/script>') }
</script>
Upvotes: 0
Reputation:
Use
if (typeof jQuery != 'undefined') {
alert("jQuery library is loaded!");
}else{
alert("jQuery library is not found!");
}
or
if (jQuery) {
alert("jQuery library is loaded!");
} else {
alert("jQuery library is not found!");
}
Upvotes: 2