genxgeek
genxgeek

Reputation: 13347

How to escape ' for a:contains(...)

How can I escape content for characters such as an apostrophe ?

The following a:contains is choking on the string literal

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

Upvotes: 2

Views: 106

Answers (1)

VisioN
VisioN

Reputation: 145368

You can try this:

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

Or this:

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

Upvotes: 14

Related Questions