I tried it with a newer version of bootstrap (3.3.4), and the code in the question worked when the correct files were included.
There was no need to use the bootstrap version of the CDN (but you can if you want).
I have bootstrap in a subdirectory and the following in my HTML:
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css"> <script src="bootstrap/js/bootstrap.min.js"></script>
(I understand that the question is old, but I think my answer is more relevant than the accepted answer, and I hope it helps someone)
paulo62
source share