Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Javascript escape problem

Options
  • 14-09-2006 12:31pm
    #1
    Registered Users Posts: 4,074 ✭✭✭


    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 Posts: 26 ast


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


  • Registered Users Posts: 4,074 ✭✭✭muckwarrior


    That done the trick, cheers.


Advertisement