Solved

Trying to use .replace to get rid of a minus sign if present, but not working

Posted on 2013-06-29
2
399 Views
Last Modified: 2013-06-29
HI,
I seem to be getting a 'not a function' error when using this line in the code below:
unique_opens_percent = unique_opens_percent.replace("", "-");

I'm trying to remove a dash/minus sign that may be in the unique_opens_percent variable.
Any idea where I'm going wrong? If I take out the line, the rest of the code works fine.


var unique_opens_percent = data.campaign.unique_opens / (data.previous_campaign.campaign.unique_opens/100) - 100;
	unique_opens_percent = unique_opens_percent.replace("", "-");
	unique_opens_percent = unique_opens_percent.toFixed(0);

Open in new window


Thanks for any help.
tj
0
Comment
Question by:tjyoung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39287309
unique_opens_percent = unique_opens_percent.toString().replace("-", "");
0
 
LVL 1

Author Closing Comment

by:tjyoung
ID: 39287322
Worked perfect Gary. Thanks very much. I'll leave you alone now :)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question