View Full Version : jQuery binding problems

11-04-2010, 07:44 AM
hey guys,
i have this code, and i dont know why it doesn't work.
what i want it to do is when the link is clicked a message will be shown inside the div with the "la" id.


<script type="text/javascript" src="jquery.js"></script>

var foo=function(e){
$('#la').html('hello world');

<div id="la"></div>
<a href="javascript:void(0)" id="physics">Physics Section</a>


thanks in adv.

11-04-2010, 11:56 AM
You need to wrap your click handler within a document ready call:


11-04-2010, 02:35 PM
i've also noticed that by moving the code-lines after the divs, it works fine.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum