Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home for chromium.org
« Groups Home
Uncaught TypeError: Object #<an HTMLElement> has no method 'replace'
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Etherovamon  
View profile  
 More options Jan 31 2011, 4:55 pm
From: Etherovamon <tsartsa...@gmail.com>
Date: Mon, 31 Jan 2011 13:55:10 -0800 (PST)
Local: Mon, Jan 31 2011 4:55 pm
Subject: Uncaught TypeError: Object #<an HTMLElement> has no method 'replace'
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
PhistucK  
View profile  
 More options Feb 2 2011, 7:27 am
From: PhistucK <phist...@gmail.com>
Date: Wed, 2 Feb 2011 14:27:17 +0200
Local: Wed, Feb 2 2011 7:27 am
Subject: Re: [crx] Uncaught TypeError: Object #<an HTMLElement> has no method 'replace'

You have a basic JavaScript DOM API error here.
This is not a JavaScript learning group. Please, next time, search for
answers through a general search engine (if it also does not work within a
regular web page\JavaScript, then it must be unrelated to extensions).

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(",", "");

(No need to append it, it will change the element with this code already.)

☆*PhistucK*


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »