SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,338
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Placeholder text does not wrap in text field.

    In this code:
    HTML Code:
    <li><textarea name="Summaries" cols="20" rows="7" style="background-color:#fff; color:#000; height:40em;" placeholder="Don't type here. After tapping Load, what you typed above will appear here. Just copy data from here to your email client to export."  ></textarea></li>
    The placeholder text does not wrap and stay in the field, but stays on one line and is cut off at right border. How do I get it to wrap? This is on an HTML page and will be viewed in the iPhone.

    Thanks,
    Steve

  2. #2
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,338
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It also does not wrap when viewed in Safari on the desktop Is this normal behavior?

  3. #3
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    It wraps in Fx as it should, so I am guessing you have some other styles at play or something.

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Why are you using a placeholder attribute to tell people not to type in the field rather than using a readonly attribute which will simply prevent them from doing so?

    Code HTML4Strict:
    <li><textarea name="Summaries" cols="20" rows="7" style="background-color:#fff; color:#000; height:40em;" readonly></textarea></li>
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,338
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I never heard of the readonly attribute! Thanks! Besides, I wanted to let them know the purpose of the field so they could use it.

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The readonly attribute was introduced in HTML 3.02 so it is fast approaching its 20th anniversary as a part of the standards - unlike the placeholder attribute which is over 20 years younger (since it is still a long way off becoming a part of the standards).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  7. #7
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,338
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'm using placeholders everywhere to let the user know he has only 30 characters. Then he knows the field won't expand for more text.

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by StevenHu View Post
    I'm using placeholders everywhere to let the user know he has only 30 characters. Then he knows the field won't expand for more text.
    Just as long as you remember that most browsers don't support it yet as it is still only a proposed addition to a future standard.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  9. #9
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,338
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Oh, that's good to know. I'm only using it in the Safari browser engine, which is used in the iPhone.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •