How to display a " in an input box

S

Stefan Mueller

How can I display a " in an input box?

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

Stefan
 
B

Benjamin Niemann

Stefan said:
How can I display a " in an input box?

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

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

Stefan Mueller

How can I display a " in an input box?
Use either value="&quot;", value=""" or value='"'

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

Stefan
 
J

Jukka K. Korpela

Stefan Mueller said:
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.
 
B

Benjamin Niemann

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

'htmlentities' should do the job.
 
Y

Yucky Korpulent

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,
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top