473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Manipulating a textarea

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
8 2874
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Csaba Gabor | last post by:
What I'd like to do is to be able to set the font of a textarea element to the same font that another element is using (say, for example, an <INPUT type=text ...> element, but if that's a no go,...
1
by: Volt | last post by:
is there any way to select and mark part of text in textarea by regular expression? i need to select the first string in textarea whitch is like xxxxx,xxx where x is any character
4
by: TJS | last post by:
can the rows and columns of a textarea element with an id be changed on the fly ? if so is there an example ?
4
by: Greg Scharlemann | last post by:
Hey all, I'm working on setting up a "Send this link to a Friend" page. The page has a couple of inputs and a textarea. I have some default text in the textarea that is populated at the time...
6
by: wperry1 | last post by:
I am writing a small database utility to catalog all of my favorite ASM/JS/VBS... functions and scripts on an asp page. Everything is going smoothly except for one thing that I can't quite seem to...
6
by: Tony | last post by:
The w3schools HTML tag reference for <textarea> http://www.w3schools.com/tags/tag_textarea.asp says that the attributes 'cols' and 'rows' are REQUIRED attributes for the textarea tag. Looking at...
2
by: Daniel Pitts | last post by:
Why doesn't this work? I create an object which is supposed to handle the selection in both IE and Firefox, but everytime I call getText() in firefox, I get the whole textarea, not just the...
3
by: FunkHouse9 | last post by:
I'm working on a form to collect data in a textarea which and am trying to keep returns and spaces. I have a couple of functions that I Frankensteined together to replace returns with <br> and to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.