I’m trying to have a scroll function (scrollIntoView(true)) that scrolls to an element created by JS. This isn’t working because when I use document.createElement the element’s html doesn’t show up in page source so I can’t find it using document.getElementById.
@Sterling_IsfineNov 01.2010 — # I use document.createElement the element's html doesn't show up in page source so I can't find it using document.getElementById. [/QUOTE]Dynamically created elements don't show in page source nor do they need to in order to be referenced. Post all your code.
I actually found an alternative to what I was doing.
To clear up what I had a problem with:
I had a function that did this: [CODE]var img = document.createElement( "img" ); img.src = "******.jpg"; var a = document.createElement( "a" ); document.getElementById( "ytplayer_div2" ).appendChild( a );[/CODE]
And a function that did this [CODE]var element = document.getElementById(paraId); element.scrollIntoView(true);[/CODE]
The elements created by the first function didn't appear in page source so I couldn't use the second function to scroll to them.
Regardless I'm doing it a different way now. Thanks.