Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
Javascript .replace() method failing replacing ".–" with ".00"

I have a page displaying a price with .– instead of decimals .00:

<span id="product_price">123.&ndash;</span>

I am trying to switch its ending from ".–" to ".00" (or to nothing) in order to dynamically build the URL of a PayPal (unregistered) payment button, and cannot understand why Javascript's .replace() method fails replacing the .&ndash;.

Although the source code of the page shows the price is correctly written with the .&ndash; in the <span>, the console.log(amount); prints the amount with a - instead of the character entity:

var amount = jQuery("span#product_price").html();
console.log(amount);
amount = amount.toString(); // just to be sure
amount.replace('.&ndash;','.00');

Hence, I also tried amount.replace('.-','.00');

and var amount = jQuery("span#product_price").html().replace('.&ndash;','.00');

Nothing works. What I'm doing wrong? Thanks.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!