469,333 Members | 4,550 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,333 developers. It's quick & easy.

display Text under text using javascript & DHTML

2
Hi

I add a text using document.selection.createRange().
I want to add a text to the bottom of another text - similar to what we do in HTML.
<p>
xyz
</p>
<p><div style="position:relative;bottom:30px;">abc</div></p>

How can I achieve that using javascript?
Aug 16 '07 #1
3 1377
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

You may want to read about the insertBefore method. There's no insertAfter method, but the page explains how that can be achieved.
Aug 17 '07 #2
nskclr
2
I want to add the text to the text inside textarea. So I use document.selection.createRange() and populate it using createRange().text. As there is no element associated with in the textarea, I am unable to use the insertBefore() method. Please give me some other option.
Aug 17 '07 #3
acoder
16,027 Expert Mod 8TB
I want to add the text to the text inside textarea. So I use document.selection.createRange() and populate it using createRange().text. As there is no element associated with in the textarea, I am unable to use the insertBefore() method. Please give me some other option.
In that case, just add it to the value of the textarea:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("textareaID").value += whatever;
Aug 18 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

20 posts views Thread by cwdjrxyz | last post: by
4 posts views Thread by drew197 | last post: by
83 posts views Thread by liketofindoutwhy | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.