Q: Currency/Accounting format for inputBox on keyup I need to add formatting to my inputBox suited for currency, it should look like this: £000,000.000.
This what my script currently looks like: 
var elDeliveryPrice = document.getElementById('deliveryPrice');
var elOrderValue = document.getElementById('orderValue');
var formatter = new Intl.NumberFormat('gb-GB', { style: 'currency', currency: 'GBP' });

elOrderValue.addEventListener('keyup', _ => {
    let curVal = elOrderValue.value; 

    let curValFloat = parseFloat(curVal);
    if (isNaN(curValFloat)) {
        elDeliveryPrice.innerHTML = '';
        return;
    }

    elDeliveryPrice.innerHTML = formatter.format((curValFloat * 0.025) + 4);
});

Here's what the elements look like. Check out what it looks like on the live site. This script currently shows the inputted number value on keyup with an added formula to show a price that's relative to the input value on a separate div block, with currency formatting only on the output. How would I modify this code to add formatting to the inputBox whilst a user is typing? Thanks.

A: I'm not an UX expert, but from my experiences I can tell you you shouldn't do it as long as the cursor is inside the textfield. Formatting the input while the user is still typing creates a lot of frustration and "weird" behaviour for the user (jumping cursor, suddenly special characters appear, etc.). Maybe it's fine to format it back and forth when the input gains and looses focus.
However, to do it regardless what people think about your page and it's usability: Assign the formatted text to the value property of the input:
var elDeliveryPrice = document.getElementById('deliveryPrice');
var elOrderValue = document.getElementById('orderValue');
var formatter = new Intl.NumberFormat('gb-GB', { style: 'currency', currency: 'GBP' });

elOrderValue.addEventListener('keyup', _ => {
    let curVal = elOrderValue.value; 

    let curValFloat = parseFloat(curVal);
    if (isNaN(curValFloat)) {
      elDeliveryPrice.innerHTML = '';
      return;
    }

    elOrderValue.value = formatter.format((curValFloat * 0.025) + 4); // <-- this line
});

Be warned: It will most certainly result in bugs/strange behaviour/whatever.
