jquery not executed with twitter bootstrap

I am just starting to use Twitter Bootstrap which works pretty fine.

However I am trying to add some custom jquery code.

<script type='text/javascript' src='http://code.jquery.com/jquery-1.7.2.js'></script>
<script type='text/javascript' src="dist/js/bootstrap.min.js"/>
<script type='text/javascript'>
        $( "#link" ).click(function() {
            alert( "Handler for .click() called." );                

Somehow the JS alert does not get fired.

Any idea what's wrong here?

The related #link tag looks as follows:

<p><a id="link" class="btn btn-default" href="#" role="button">View details</a></p>


You can't self-close <script> tags like this:

<script type='text/javascript' src="dist/js/bootstrap.min.js"/>

Change it to:

<script type='text/javascript' src="dist/js/bootstrap.min.js"></script>

Then make sure you don't have two elements with the same link ID, that <a id="link"> exists on page load, and perhaps include an alert outside the event handler to make sure that block of code is running at all.

Need Your Help

Do standard windows .ini files allow comments?

windows comments ini

Are comments allowed in Windows ini files? (...assuming you're using the GetPrivateProfileString api functions to read them...)

Center inline block images

html css centering

I need some help centering some images