Skip to content Skip to sidebar Skip to footer

Why Can't Use \" In Html Input Tag?

i want show 12'3 in my input tag value i write this: but it's not be right WHY ? PS: i must transfer ' to " ,or change '

Solution 1:

HTML simply does not have escape sequences like other languages. In HTML attribute values the only special characters are <, & and depending on the quotes " or '. And the only to use these characters are character references:

Some authors use the character entity reference "&quot;" to encode instances of the double quote mark (") since that character may be used to delimit attribute values.

Or you use single quotes, then you don’t need to encode the double quotes and vice versa:

<INPUTTYPE="text"NAME=""value='12"3'>

Solution 2:

WHY ?

Because \ is not special in HTML. It does not escape stuff. You must use &quot; or '.

 <inputtype="text" name="somename" value='12"3' />
 <inputtype="text" name="somename2" value="12&quot;3" />

Post a Comment for "Why Can't Use \" In Html Input Tag?"