Scottus wrote:
> Now I have a script in the header,
>
>
> $("div#newcode").click(function(){alert('this works');});
>
Scottus;
For starters; There is never a need to use to scope a selector when
selecting by the ID. All it does is decrease performance of the
selector. E.g. $("div#newcode")... should be $("#newcode").
Besides that, your function looks fine. I presume that it is not firing
becuase it is executing before the DOM is ready and div#newcode
available to assign the click event to. Most jQuery code is encased in
the $(document).ready() function, which is a 100000 times more flexible
& accurate than window.onload. So use;
$().ready(function() {
$("#newcode").click(function(){alert('this works');});
});
in the header.
Hope this helps,
~ Brice
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/