...

View Full Version : Option constructor and   challenges



zeekerzulu
12-12-2009, 10: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.

JD

mrhoo
12-13-2009, 12:06 AM
use unicode when you create a text node with 'escaped' characters.

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

zeekerzulu
12-13-2009, 12:41 AM
Worked like a charm mrhoo! Thanks for the help!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum