如何逃避'为:包含(...)

时间:2012-06-12 16:25:02

标签: jquery

如何转义撇号等字符的内容?

以下a:包含对字符串文字的阻塞

$('a:contains('\This'is choking on the apostrophe\')....

1 个答案:

答案 0 :(得分:14)

你可以试试这个:

$('a:contains("This isn\'t choking on the apostrophe")')

或者这个:

$("a:contains('This isn\'t choking on the apostrophe')")