How can I get bootstrap version via javascript?
You can use this code found here :
var getBootstrapVersion = function () {
var deferred = $.Deferred();
var script = $('script[src*="bootstrap"]');
if (script.length == 0) {
return deferred.reject();
}
var src = script.attr('src');
$.get(src).done(function(response) {
var matches = response.match(/(?!v)([.\d]+[.\d])/);
if (matches && matches.length > 0) {
version = matches[0];
deferred.resolve(version);
}
});
return deferred;
};
getBootstrapVersion().done(function(version) {
console.log(version); // '3.3.4'
});
The version of each of Bootstrap's jQuery plugins can be accessed via the VERSION property of the plugin's constructor. For example, for the tooltip plugin:
$.fn.tooltip.Constructor.VERSION // => "3.3.7"
src //getbootstrap.com/javascript/#js-version-nums
if you mean from the css, then yu ahve to AJAX the file and .match(/v[.\d]+[.\d]/);