You are trying to call the "replace" method of a DOM element. Only strings
(or special\user defined objects) have that "replace" method.
This is the right code -
var something = document.getElementById('else');
something.textContent = something.textContent.replace(",", "");
On Mon, Jan 31, 2011 at 23:55, Etherovamon <tsartsa
...@gmail.com> wrote:
> First of all I would like to give you all my congrats for the great
> work you are doing here.
> I am building an extension, taking a value from a page and reusing
> this value for a calculation. Then I inject the value in a div of the
> page so I can see it.
> The problem I came up with is this
> "Uncaught TypeError: Object #<an HTMLElement> has no method 'replace'"
> I have a string like "1,000"
> I want to take out the "," and I use in the contentscript this code
> var something;
> something = document.getElementById('else');
> something = something.replace(",","");
> document.getElementById('whatever').appendChild(something);
> --
> You received this message because you are subscribed to the Google Groups
> "Chromium-extensions" group.
> To post to this group, send email to chromium-extensi...@chromium.org.
> To unsubscribe from this group, send email to
> chromium-extensions+unsubscr...@chromium.org.
> For more options, visit this group at
> http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.