转义HTML标记属性中的双引号 [英] Escaping the double quote that is in the attribute of an HTML tag

查看:105
本文介绍了转义HTML标记属性中的双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有属性的HTML页面.当我插入名为"control_label"的属性时.当我在此属性中分配一个值"Enters Your Name"时,一切正常.

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.

但是当我尝试添加一个值时,请说"输入您的姓名" ,该属性的值不会变成输入您的姓名" .甚至我尝试使用 Enters Your Name \"之类的转义字符,该值也将变为 Enters Your Name \ ,而不是 Enters Your Name" .

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/

感谢您的帮助.

推荐答案

HTML不使用\来转义字符,而是使用实体.

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

"

这篇关于转义HTML标记属性中的双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆