Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<p class="price">₿ 21,000,000.00000000</p>
</body>
</html>
 
document.querySelectorAll('.price').forEach(element => {
  const text = element.textContent;
  const [symbol, price] = text.split(' ');
  const [integerPart, decimalPart] = price.split('.');
  const formattedDecimal = decimalPart
    .replace(/(\d{2})(\d{3})(\d{3})/, '$1 $2 $3') // Add non-breaking spaces
    .split(' ')
    .map(segment => `<span class="segment">${segment}</span>`)
    .join('');
 element.innerHTML = `
    <span class="symbol">${symbol}</span>
    <span class="price-value">
      ${integerPart}.${formattedDecimal}
    </span>
  `;
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers