Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-30-2011, 07:53 AM   PM User | #1
anabelle345
New to the CF scene

 
Join Date: Sep 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
anabelle345 is an unknown quantity at this point
getElementById – undefined

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.
anabelle345 is offline   Reply With Quote
Old 09-30-2011, 08:38 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,195
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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()
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Old 09-30-2011, 09:29 AM   PM User | #3
jassi.singh
Regular Coder

 
Join Date: Sep 2011
Posts: 103
Thanks: 0
Thanked 14 Times in 14 Posts
jassi.singh can only hope to improve
Hi, You can use getElement by id as show below
Code:
document.getElementById("control.clientID").innerHTML
jassi.singh is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:45 PM.


Advertisement
Log in to turn off these ads.