Adetoro Lanre Adetoro Lanre - 1 year ago 72
jQuery Question

JavaScript not working in JQuery Load

I wan to display a code with JavaScript then load it using


Here is my codes :

<div class="noti"><span name="creator">::creator::</span></div>

<script type="text/javascript"> creators=document.getElementsByName('creator'); for(i=0;i<creators.length;i++){creator=document.getElementsByName('creator')[i].innerHTML; :userstats:d=ru,o=dl,s=1,l=50::if(creator=='%name%'){document.getElementsByName('avatar')[i].innerHTML='<a href="%urlprofile%"><img src="%urlpicture%" width="40" height="43" style="background: url(;" width: 40; height: 43;"/></a>';}:: :/userstats:}</script>

Then in another url, load with this :

<div class="title">NOTIFICATION</div><div id="noti">Loading notification...</div>
<script type="text/javascript"> $('#noti').load('/popup_0.xhtml .noti',function(data){$(this).find('.noti').css({"width":"96%","margin":"auto"}); }); </script>

The problem is the result of span name creator is not displayed in the JQuery load but it displays in the 1st

Answer Source

That because the changes made by your javascript doesn't affect source/original file popup_0.xhtml, but still affected just the DOM loaded in the browser, when the load() function get the code inside the source file.

Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download