By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,793 Members | 1,257 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,793 IT Pros & Developers. It's quick & easy.

Manipulating a textarea

P: n/a
Hi, for the past few days now im trying to find some info on how to
manipulate textarea's with javascript. Im trying to add content when a
certain element is clicked or alter content if another is clicked (wrap
ubb tags around it).

I have found quite a few examples but they either dont work on all major
browsers (example
http://phphulp.jorendewit.nl/snippet...script/ubb.php) or they are
complete WYSIWYG editors and have quite a large footprint (as most
people on the www just recommend tinymce).

Does anyone know of an example that does the trick or can anyone push me
in the right direction ?

Floortje
Oct 22 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On Oct 22, 8:44*am, Floortje <floor...@dontlike.mailwrote:
Hi, for the past few days now im trying to find some info on how to
manipulate textarea's with javascript. Im trying to add content when a
certain element is clicked or alter content if another is clicked (wrap
ubb tags around it).
Wrap "ubb tags" around what? A textarea can only contain text.
>
I have found quite a few examples but they either dont work on all major
* browsers (examplehttp://phphulp.jorendewit.nl/snippets/javascript/ubb..php) or they are
No shock there.
complete WYSIWYG editors and have quite a large footprint (as most
people on the www just recommend tinymce).
Most people on the www are pinheads.
>
Does anyone know of an example that does the trick or can anyone push me
in the right direction ?
To set the value of a textarea? No trick required. Set its value
property.
Oct 22 '08 #2

P: n/a
David Mark schreef:
On Oct 22, 8:44 am, Floortje <floor...@dontlike.mailwrote:
>Hi, for the past few days now im trying to find some info on how to
manipulate textarea's with javascript. Im trying to add content when a
certain element is clicked or alter content if another is clicked (wrap
ubb tags around it).

Wrap "ubb tags" around what? A textarea can only contain text.
wrap ubb tags around the text in the textarea

<snip>
>Does anyone know of an example that does the trick or can anyone push me
in the right direction ?

To set the value of a textarea? No trick required. Set its value
property.
Yup but how do I change the value and add / alter texted based ont he
curcur position inside the textarea.
Oct 22 '08 #3

P: n/a
Floortje <do**@mail.mewrote:
^^^^^^^^^^^^
I won't, because I can't. And that's why you will get no answer here, too.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Oct 22 '08 #4

P: n/a
On Oct 22, 6:53*pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
Floortje <d...@mail.mewrote:

* * * * * ^^^^^^^^^^^^
I won't, because I can't. *And that's why you will get no answer here, too.
Well said.
Oct 22 '08 #5

P: n/a
On Thu, 23 Oct 2008 00:14:07 +0200, Floortje <do**@mail.mewrote:
David Mark schreef:
>On Oct 22, 8:44 am, Floortje <floor...@dontlike.mailwrote:
>>Hi, for the past few days now im trying to find some info on how to
manipulate textarea's with javascript. Im trying to add content when a
certain element is clicked or alter content if another is clicked (wrap
ubb tags around it).
Wrap "ubb tags" around what? A textarea can only contain text.

wrap ubb tags around the text in the textarea

<snip>
>>Does anyone know of an example that does the trick or can anyone push
me
in the right direction ?
To set the value of a textarea? No trick required. Set its value
property.

Yup but how do I change the value and add / alter texted based ont he
curcur position inside the textarea.
To rephrase (probably still in far from fluent english):
"How can I get only the currently selected and/or the cursor position in a
textarea, and how can I replace this and only this text, leaving the not
selected contents of the textarea intact"

Never needed to dabble with that, but at least phrased that way one gets
less semantics fanatics excited :P
--
Rik
Oct 22 '08 #6

P: n/a
On Oct 22, 6:14*pm, Floortje <d...@mail.mewrote:
David Mark schreef:
On Oct 22, 8:44 am, Floortje <floor...@dontlike.mailwrote:
Hi, for the past few days now im trying to find some info on how to
manipulate textarea's with javascript. Im trying to add content when a
certain element is clicked or alter content if another is clicked (wrap
ubb tags around it).
Wrap "ubb tags" around what? *A textarea can only contain text.

wrap ubb tags around the text in the textarea
Okay, I Googled ubb (sic) tags. Yes, you can use them with a
textarea; and no, tinyMCE would not have been a good choice.
>
<snip>
Does anyone know of an example that does the trick or can anyone push me
Not a good one.
in the right direction ?
https://developer.mozilla.org/en/NsISelection
Oct 23 '08 #7

P: n/a
Rik Wasmus wrote:
To rephrase (probably still in far from fluent english):
"How can I get only the currently selected and/or the cursor position in
a textarea, and how can I replace this and only this text, leaving the
not selected contents of the textarea intact"

Never needed to dabble with that, but at least phrased that way one gets
less semantics fanatics excited :P
hi Rik,

Thx that is what I mean :-)

Floortje
Oct 23 '08 #8

P: n/a
David Mark wrote:
>>>in the right direction ?

https://developer.mozilla.org/en/NsISelection
cool thx ill start from there :-)

Floortje
Oct 23 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.