thanks you answer didn't exactly answer my question but it got me thinking
in the correct way. IE i needed to reload the script AFTER the new
html/dom is added.  So I put script tag and fuctions at the bottom of
the page i was loading into the div. And it was all good.

thanks

On 2/27/07, Brice Burgess <[EMAIL PROTECTED]> wrote:
> 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/
>


-- 
    Scott Wickham

********************************************************************************************
Everyone is equal and everyone is the best at everything.  ---
Principal Skinner

"Success is a lousy teacher. It seduces smart people into thinking
they can't lose."       -Bill Gates

99% of the time, in my experience, the hard part about creativity
isn't coming up with something no one has ever thought of before. The
hard part is actually executing the thing you've thought of.  -- seth
godin


********************************************************************************************

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to