Manipulating a textarea

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Floortje

    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
  • David Mark

    #2
    Re: Manipulating a textarea

    On Oct 22, 8:44 am, Floortje <floor...@dontl ike.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.jorende wit.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.

    Comment

    • Floortje

      #3
      Re: Manipulating a textarea

      David Mark schreef:
      On Oct 22, 8:44 am, Floortje <floor...@dontl ike.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.

      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: Manipulating a textarea

        Floortje <dont@mail.mewr ote:
        ^^^^^^^^^^^^
        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

        Comment

        • David Mark

          #5
          Re: Manipulating a textarea

          On Oct 22, 6:53 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
          wrote:
          Floortje <d...@mail.mewr ote:
          >
                    ^^^^^^^^^^^^
          I won't, because I can't.  And that's why you will get no answer here, too.
          >
          Well said.

          Comment

          • Rik Wasmus

            #6
            Re: Manipulating a textarea

            On Thu, 23 Oct 2008 00:14:07 +0200, Floortje <dont@mail.mewr ote:
            David Mark schreef:
            >On Oct 22, 8:44 am, Floortje <floor...@dontl ike.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

            Comment

            • David Mark

              #7
              Re: Manipulating a textarea

              On Oct 22, 6:14 pm, Floortje <d...@mail.mewr ote:
              David Mark schreef:
              >
              On Oct 22, 8:44 am, Floortje <floor...@dontl ike.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 ?
              The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.

              Comment

              • Floortje

                #8
                Re: Manipulating a textarea

                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

                Comment

                • Floortje

                  #9
                  Re: Manipulating a textarea

                  David Mark wrote:
                  >>>in the right direction ?
                  >
                  https://developer.mozilla.org/en/NsISelection
                  cool thx ill start from there :-)

                  Floortje

                  Comment

                  Working...