Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Location
    Christchurch, NZ
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Option constructor and   challenges

    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

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    726
    Thanks
    35
    Thanked 132 Times in 123 Posts
    use unicode when you create a text node with 'escaped' characters.

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

  • #3
    New to the CF scene
    Join Date
    Dec 2009
    Location
    Christchurch, NZ
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Issue resolved!!!

    Worked like a charm mrhoo! Thanks for the help!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •