The bootstrap documentation says, you can easily disable the data API with following code:
$('body').off('.data-api');
I thought that's really cool for some cases, when other javascripts are using the same data-attributes. You only have to disable the bootstrap-API in the special region.
For example disabling the API in each a-Tag:
<html>
<head>
<title>Bootstrap - Test - Disable The API</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function() {
//This is working: $(document).off('.data-api');
//This is not working:
$('a').off('.data-api');
});
</script>
</head>
<body>
<!-- Button to open the modal -->
<a id="clickBtn" href="#myModal" data-toggle="modal">Launch demo modal</a>
<!-- Modal -->
<div id="myModal" class="modal hide fade">
This is just a little test
</div>
</body>
</html>
But it didn't work.
There is still a clickEvent
for the modal.
Can anybody tell me what I have done wrong?
It's not working for $('#clickBtn').off('.data-api');
either.