472,146 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

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 1454
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.