How to display a " in an input box

Discussion in 'HTML' started by Stefan Mueller, Mar 19, 2006.

  1. How can I display a " in an input box?

    I tried
    <input type = "text" value = "\"">
    without success.

    Stefan
     
    Stefan Mueller, Mar 19, 2006
    #1
    1. Advertising

  2. Stefan Mueller wrote:

    > How can I display a " in an input box?
    >
    > I tried
    > <input type = "text" value = "\"">
    > without success.


    Use either value="&quot;", value=""" or value='"'

    --
    Benjamin Niemann
    Email: pink at odahoda dot de
    WWW: http://pink.odahoda.de/
     
    Benjamin Niemann, Mar 19, 2006
    #2
    1. Advertising

  3. >> How can I display a " in an input box?
    >>
    >> I tried
    >> <input type = "text" value = "\"">
    >> without success.

    >
    > Use either value="&quot;", value=""" or value='"'


    Isn't there something like the PHP command
    addslashes(...)
    so that each character gets displayed properly?

    Stefan
     
    Stefan Mueller, Mar 19, 2006
    #3
  4. "Stefan Mueller" <> wrote:

    > How can I display a " in an input box?


    There's no problem with it in input.

    > I tried
    > <input type = "text" value = "\"">
    > without success.


    Using it in the _prefilled_ content requires a special method, just as any
    inclusion of " into an attribute value delimited with " characters:

    <input type = "text" value = "&quot;">

    Alternatively, you could use

    <input type = "text" value = '"'>

    but that's somewhat obscure.

    On the other hand, there is _seldom_ reason to include " into the prefilled
    (default) content. The idea of using it is probably a wrong approach to the
    primary problem, which has not been disclosed.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Mar 19, 2006
    #4
  5. Stefan Mueller wrote:

    >>> How can I display a " in an input box?
    >>>
    >>> I tried
    >>> <input type = "text" value = "\"">
    >>> without success.

    >>
    >> Use either value="&quot;", value=""" or value='"'

    >
    > Isn't there something like the PHP command
    > addslashes(...)
    > so that each character gets displayed properly?


    'htmlentities' should do the job.

    --
    Benjamin Niemann
    Email: pink at odahoda dot de
    WWW: http://pink.odahoda.de/
     
    Benjamin Niemann, Mar 19, 2006
    #5
  6. > 'htmlentities' should do the job.

    Yes, that works. Many thanks
    Stefan
     
    Stefan Mueller, Mar 20, 2006
    #6
  7. To elaborate on my previous proclamation that you are "probably [using]
    a wrong approach to the primary problem," please be aware that this
    assumption is predicated on my belief that most people here are, in
    fact, idiots. Idiots with questions that are misguided because they do
    not know what they "really" want. Just wanted to clear up any
    misconceptions that I may not be an insufferably conceited buffoon.

    For more enlightenment on the proper way to solve problems, please
    visit http://www.cs.tut.fi/~jkropela/ to see pages so firmly entrenched
    in my web authoring dogma that they reek of a website developed circa
    1994. This is what you should be striving to achieve.

    Yucky,
     
    Yucky Korpulent, Mar 20, 2006
    #7
    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. ashutosh
    Replies:
    3
    Views:
    9,012
    Andrew Thompson
    Jun 16, 2005
  2. Gnarlodious
    Replies:
    4
    Views:
    17,622
    elizas
    May 5, 2010
  3. cjl
    Replies:
    1
    Views:
    10,507
    Michael Winter
    Oct 31, 2005
  4. C Chang
    Replies:
    0
    Views:
    92
    C Chang
    Sep 29, 2004
  5. cjl
    Replies:
    7
    Views:
    187
    Thomas 'PointedEars' Lahn
    Oct 30, 2005
Loading...

Share This Page