Adding Break Tags to Input Form

Discussion in 'Javascript' started by Papajo, Jan 7, 2006.

  1. Papajo

    Papajo Guest

      I'd like to know how to add break tags "<br>" inbetween entry's in
    an input form, an example is if the word "yada yada" was entered you
    would wind up with y<br>a<br>d<br>a<br> y<br>a<br>d<br>a

    I would like to able to add the break tags with a button onClick. I have
    no idea where to start, sorry. Any help is appreciated, Thanks Joe
     
    Papajo, Jan 7, 2006
    #1
    1. Advertising

  2. Papajo

    Lee Guest

    Papajo said:
    >
    >I'd like to know how to add break tags "<br>" inbetween entry's in
    >an input form, an example is if the word "yada yada" was entered you
    >would wind up with y<br>a<br>d<br>a<br> y<br>a<br>d<br>a


    You need to be more precise in describing what you want.
    You talk about an "input form", but seem to mean a "text input element"
    (or "text input control"). You say that you want the breaks to be
    inserted "between entries", but your example shows it being inserted
    between the non-whitespace characters of a single entry.

    It might also help to know why you want this.
     
    Lee, Jan 7, 2006
    #2
    1. Advertising

  3. Papajo

    Patient Guy Guest

    (Papajo) wrote in news:5644-43BF2BEE-207@storefull-
    3332.bay.webtv.net:

    >   I'd like to know how to add break tags "<br>" inbetween entry's in
    > an input form, an example is if the word "yada yada" was entered you
    > would wind up with y<br>a<br>d<br>a<br> y<br>a<br>d<br>a


    You are likely interested in learning about how to manipulate documents
    with DOM methods.

    > I would like to able to add the break tags with a button onClick. I have
    > no idea where to start


    Start with the following:

    http://www.w3.org/DOM/
    http://developer.mozilla.org/en/docs/Category:DOM:Articles

    The short lesson is that a document's structure and style can be
    "objectified". Paragraph(s), sentences, words, characters---printable and
    otherwise---can be treated as objects and properties gotten or set and
    methods used to alter the objects. The document is structured as a TREE
    with branch points (NODES). The document is rendered as a tree in this way
    by the document reader/parser when initially loaded/read, but through these
    DOM methods in script, these nodes can be INSERTED/APPENDED or REMOVED to
    modify the document structure dynamically. A very simplified explanation.
     
    Patient Guy, Jan 7, 2006
    #3
  4. Papajo

    Evertjan. Guest

    Papajo wrote on 07 jan 2006 in comp.lang.javascript:

    > ÿI'd like to know how to add break tags "<br>" inbetween entry's in
    > an input form, an example is if the word "yada yada" was entered you
    > would wind up with y<br>a<br>d<br>a<br> y<br>a<br>d<br>a
    >


    t1 = 'yada yada'

    t2 = t1.replace(/( ?[^ ])/g,'$1<br>').replace(/<br>$/,'')

    alert(t2)

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jan 7, 2006
    #4
  5. Papajo

    Papajo Guest

    Thank you guy's, with the code snippet and lessons I was able to get
    the script running. Joe
     
    Papajo, Jan 7, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Reichgruber

    Adding a line break to a Panel-Object

    Thomas Reichgruber, Jan 31, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    6,616
    Kevin Spencer
    Jan 31, 2004
  2. =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=

    Adding a page break between items in a ASP.NET datalist output

    =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=, Jun 30, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    10,208
    John Saunders
    Jul 5, 2004
  3. Joe via DotNetMonster.com

    HTML Tags in input form

    Joe via DotNetMonster.com, Jan 25, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,897
    Alan Silver
    Feb 1, 2005
  4. Jay Balapa
    Replies:
    2
    Views:
    642
    John Saunders [MVP]
    Jun 19, 2007
  5. Replies:
    12
    Views:
    1,027
Loading...

Share This Page