Setting a button value to contain an ampersand coded character via JavaScript

html, javascript

Solution

here just convert to UTF it should work.

document.getElementById('hideButton').value='\u00AB';
document.getElementById('otherButton').value='\u00BB';

here a link to convert special text

Problem

I'm trying to set a button value to be « (or ») via JavaScript with the following code: ``` document.getElementById('hideButton').value='&laquo;'; ``` This just sets the button text to `&laquo;` rather than «. The HTML markup works fine (i.e. `<input type="button" value="&laquo;">`) giving the double left arrow quote on the button face. Is there some special way of escaping the ampersand code in JavaScript? Thanks, FM

Original source