469,322 Members | 1,634 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,322 developers. It's quick & easy.

dynamically loaded DIV

cmt
I have a <divon my page that is dynamically loaded via javascript.
This part works fine, however any javascripts or javascript function
calls that happen to be in the dynamically loaded content, do not
work!

Not even a simple alert('hi!'); works...it's like the browser ignores
any scripts that are in the dynamically loaded <div>.

Is there a way around this?

Thanks!
Mar 27 '08 #1
2 1144
SAM
cmt a écrit :
I have a <divon my page that is dynamically loaded via javascript.
This part works fine, however any javascripts or javascript function
calls that happen to be in the dynamically loaded content, do not
work!
Which borwser ?
(all do not react similar)
Not even a simple alert('hi!'); works...it's like the browser ignores
any scripts that are in the dynamically loaded <div>.
I think it can read CSS (In tests that I have done with Firefox)
Is there a way around this?
Have a look here to see how and when a browser understands there could
be a new script :
<http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/>

Probably you'll have to
- create a new element 'script'
- innerHTML in this new element the script element (its content ?)
just loaded in the div, or just before to display the responseText
- then insert this new script in the body or the header

--
sm
Mar 27 '08 #2
cmt wrote:
I have a <divon my page that is dynamically loaded via javascript.
This part works fine, however any javascripts or javascript function
calls that happen to be in the dynamically loaded content, do not
work!

Not even a simple alert('hi!'); works...it's like the browser ignores
any scripts that are in the dynamically loaded <div>.

Is there a way around this?

Thanks!
I have written javascript calls inside a dynamically written <divin a
return from AJAX (which is then handled by javascript). Those calls
worked. Can you show your code?
Mar 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Donald Xie | last post: by
4 posts views Thread by Harry | last post: by
7 posts views Thread by Nathan Sokalski | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.