Manipulating a textarea

F

Floortje

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/snippets/javascript/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
 
D

David Mark

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.
 
F

Floortje

David Mark schreef:
Wrap "ubb tags" around what? A textarea can only contain text.

wrap ubb tags around the text in the textarea

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.
 
T

Thomas 'PointedEars' Lahn

^^^^^^^^^^^^
I won't, because I can't. And that's why you will get no answer here, too.


PointedEars
 
R

Rik Wasmus

David Mark schreef:

wrap ubb tags around the text in the textarea



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
 
F

Floortje

Rik said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top