View Full Version : Option constructor and   challenges

12-12-2009, 09:34 PM
Hi All,

Why is the Option constructor converting my text as follows?

text = '  1:30 pm'

Option tag that gets generated:

<option value="10">&amp;nbsp;&amp;nbsp;1:30 pm</option>

How do I suppress the conversion of the & to &amp; by the constructor?

I've tried escaping the & but that's a no go.

Thanks in advance for any help on this.


12-12-2009, 11:06 PM
use unicode when you create a text node with 'escaped' characters.

var t = document.createTextNode("\u00a0\u00a0 1:30 pm");

12-12-2009, 11:41 PM
Worked like a charm mrhoo! Thanks for the help!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum