innerHTML will work but you need to remove any tags in tat may be inside it

var regExp = /<\/?[^>]+>/gi;
      function ReplaceTags(xStr){
        xStr = xStr.replace(regExp,"");
        return xStr;
      }

A little snippet i found on google would work here

var total=ReplaceTags($('foo').innerHTML);
alert(parseFloat(total));

Enjoy :)

----- Original Message ----- 
From: "Luca Manganelli" <[EMAIL PROTECTED]>
To: <prototype-scriptaculous@googlegroups.com>
Sent: Thursday, November 06, 2008 9:44 AM
Subject: [Proto-Scripty] Re: Simple $( ) question



Try:

var total = parseFloat($('foo').innerHTML);

On Thu, Nov 6, 2008 at 03:06, Scott <[EMAIL PROTECTED]> wrote:
>
> If I have an element:
>
>  <span id='foo'>50</span>
>
> Should I be able to say the following?
>
>  var total = parseFloat($('foo'));
>
> Instead, I am getting a return value of:
>
>  [object HTMLSpanElement]
>
> and parseFloat is returning NaN.
>
> Thanks in advance.
>
> >
>



-- 
Grazie al modello matematico posso dirvi Come è nato l'universo:
  non chiedetemi il Perché. (Stephen Hawking)




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to