Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Javascript escape problem

  • 14-09-2006 12:31PM
    #1
    Registered Users, Registered Users 2 Posts: 4,123 ✭✭✭


    I've got a javascript calculator that updates input fields on the page. My problem is that i cant get it to print the euro symbol properly to the input field. Here's basically what i've got:
    <input type="text" name="total" id="total" readonly="true" class="showamount" />
    
    totalField.value = "&euro;" + total;
    
    What happens is that the euro code is escaped resulting in something like "€100" instead of "€100". I've tried using the unescape function but it doesn't make any difference.

    I know the first thing you'll probably say is to just hardcode the euro symbol outside the text box, but for display reasons this isn't an option.

    I'm sure i'm just overlooking something simple, can anyone shed any light?


Comments

  • Registered Users, Registered Users 2 Posts: 26 ast


    You could (and probably have to) use the unicode escapes for the euro symbol.
    totalField.value = "\u20AC" + total;
    


  • Registered Users, Registered Users 2 Posts: 4,123 ✭✭✭muckwarrior


    That done the trick, cheers.


Advertisement