Morgs Morgs - 1 year ago 168
Javascript Question

Javascript Split/Join Or Replace spaces globally

I am running outta my mind now, can someone please explain what is happening here:


Why's the same JS function producing different results?

Here's the actual HTML:

<input id="xamount" data-pr-xamount="1" value="R 5 700,00" placeholder="Enter Amount" style="width: 88%;" class="valid" type="text">

Answer Source

Those spaces may not be traditional spaces, try splitting on actual white-space:


In your case:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download