how to add text to div in IE
|
| View previous topic :: View next topic |
| Author |
Message |
froomzer
Joined: 23 May 2006 Posts: 148
|
How do I add text to <div> in IE ?
O.type is undefined
Comments.innerHTML=str; worfroomzer in FF |
| |
|
|
|
|
autos06
Joined: 13 May 2006 Posts: 123 Location: New York
|
| addChild(document.newTextNode(str)) is the correct DOM way of doing it. |
| |
|
|
froomzer
Joined: 23 May 2006 Posts: 148
|
| Let me try it |
| |
|
|
autos06
Joined: 13 May 2006 Posts: 123 Location: New York
|
| Err. That should of course be foo.addChild where foo is your div. |
| |
|
|
froomzer
Joined: 23 May 2006 Posts: 148
|
autos06, i did
Var txt = document.createTextNode(str);
Comments.appendChild(txt);
Thanfroomzer for help |
| |
|
|
autos06
Joined: 13 May 2006 Posts: 123 Location: New York
|
No problem.
You should really use things like this instead of innerHTML in general. It's not just to make it work in IE.  |
| |
|
|
froomzer
Joined: 23 May 2006 Posts: 148
|
| Hm.. it still not showing in IE |
| |
|
|
autos06
Joined: 13 May 2006 Posts: 123 Location: New York
|
| Really? |
| |
|
|
froomzer
Joined: 23 May 2006 Posts: 148
|
| Yep |
| |
|
|
autos06
Joined: 13 May 2006 Posts: 123 Location: New York
|
| That should work. Actually, for that matter so should innerHTML |
| |
|
|
|
|