Inserting a no-break-space in a DOM textnode

Discussion in 'JavaScript' started by Steviebone, Jul 17, 2007.

  1. #1
    How do u insert a literal such as   in a DOM textnode using javascript?

    In this code:

    var sp1_sup = document.createElement("sup");
    var sp1_suffix = document.createTextNode(" (" + zno + ")" );
    sp1_sup.appendChild(sp1_suffix );

    the literal string is printed.. how do I get the textnode to recognize the no break space
     
    Steviebone, Jul 17, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Why are you adding parenthesis ?. And what's the value of zno
    Anyway, if I understood you correctly, you can try with HTML entities:
    $#32; or $nbsp; (replace '$' by '&').
     
    ajsa52, Jul 17, 2007 IP