...

View Full Version : getElementById undefined



anabelle345
09-30-2011, 08:53 AM
I am using this code to generate hidden HTML code in Facebook :

echo "<div id=\"y257y\" style=\"display:none;\">".$fdesc."</div>";

And, I am trying to get this element back in JS using the following code

newVal=document.getElementById('y257y').getValue();

But, I am getting an error: Undefined

Can anyone kindly help me out ?

Thanks.

Old Pedant
09-30-2011, 09:38 AM
Probably, it is getValue() that is undefined.

Probably you need to use document.getElementById("y257y").innerHTML

A <div> doesn't have a value. And even for elements that do have values, you would use .value and not .getValue()

jassi.singh
09-30-2011, 10:29 AM
Hi, You can use getElement by id as show below

document.getElementById("control.clientID").innerHTML



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum