1

i have a HTML page having a attribute. When i insert the attribute named "control_label". When i assign a value "Enters Your Name" in this attribute everything is okay.

But when i try to add a value say " Enters Your Name" " having a single double quote the value of the attribute does not become Enters Your Name" . Even i tried a Escape character like Enters Your Name\" the value becomes Enters Your Name\ and not Enters Your Name".

http://jsfiddle.net/r3UUH/1/

Any help is appreciated.

Moons
  • 3,833
  • 4
  • 49
  • 82
  • @Beetle952580 Thanks for posting duplicate comment after 3.5 years for an accepted answer. I don't doubt you are posting comment unnecessary :) – Moons Apr 10 '15 at 06:27

3 Answers3

12

HTML doesn't use \ to escape characters, it uses entities.

"
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
4

Escape " as "

That will make browser not parse it.

value="Enter Your Name""
Rok Kralj
  • 46,826
  • 10
  • 71
  • 80
3

You can use " instead of a backslash

rap-2-h
  • 30,204
  • 37
  • 167
  • 263