Search code examples
javascripttwitter-bootstrap

How can I get Bootstrap version via Javascript?


Is there any way to get the Bootstrap version via calling a function? I did some research but couldn't find any way. The version information is included in the comments at the beginning like this:

`/*!

But in case the comments are removed how do I get the bootstrap version? Bootstrap plugins have a version defined in them but I'm looking for the general Bootstrap version, not version of a particular plugin.


Solution

  • 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 you have to AJAX the file and .match(/v[.\d]+[.\d]/);