Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Manipulating a textarea

Reply
Thread Tools

Manipulating a textarea

 
 
Floortje
Guest
Posts: n/a
 
      10-22-2008
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
 
Reply With Quote
 
 
 
 
David Mark
Guest
Posts: n/a
 
      10-22-2008
On Oct 22, 8:44*am, Floortje <(E-Mail Removed)> wrote:
> 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.
 
Reply With Quote
 
 
 
 
Floortje
Guest
Posts: n/a
 
      10-22-2008
David Mark schreef:
> On Oct 22, 8:44 am, Floortje <(E-Mail Removed)> wrote:
>> 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.
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      10-22-2008
Floortje <(E-Mail Removed)> wrote:
^^^^^^^^^^^^
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
 
Reply With Quote
 
David Mark
Guest
Posts: n/a
 
      10-22-2008
On Oct 22, 6:53*pm, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
wrote:
> Floortje <(E-Mail Removed)> wrote:
>
> * * * * * ^^^^^^^^^^^^
> I won't, because I can't. *And that's why you will get no answer here, too.
>


Well said.
 
Reply With Quote
 
Rik Wasmus
Guest
Posts: n/a
 
      10-22-2008
On Thu, 23 Oct 2008 00:14:07 +0200, Floortje <(E-Mail Removed)> wrote:

> David Mark schreef:
>> On Oct 22, 8:44 am, Floortje <(E-Mail Removed)> wrote:
>>> 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
--
Rik
 
Reply With Quote
 
David Mark
Guest
Posts: n/a
 
      10-23-2008
On Oct 22, 6:14*pm, Floortje <(E-Mail Removed)> wrote:
> David Mark schreef:
>
> > On Oct 22, 8:44 am, Floortje <(E-Mail Removed)> wrote:
> >> 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
 
Reply With Quote
 
Floortje
Guest
Posts: n/a
 
      10-23-2008
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


hi Rik,

Thx that is what I mean

Floortje
 
Reply With Quote
 
Floortje
Guest
Posts: n/a
 
      10-23-2008
David Mark wrote:

>>>> in the right direction ?

>
> https://developer.mozilla.org/en/NsISelection


cool thx ill start from there

Floortje
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add </textarea> within <textarea> tags? frank.moens@gmail.com Javascript 1 07-04-2007 04:00 PM
Manipulating selected text in a TEXTAREA... Daniel Pitts Javascript 2 11-21-2006 04:08 AM
Textarea Inside of a textarea wperry1@gmail.com ASP General 6 02-05-2006 08:00 AM
manipulating text in a textarea Greg Scharlemann Javascript 4 12-19-2005 11:03 PM
Removing carriage returns from <textarea></textarea> input Augustus ASP General 1 09-10-2003 04:55 AM



Advertisments