Question

I have an MVC4 Razor application where I need to construct a string in a javascript section containing @class. How can I escape to use that in the string?

var S = 'select * from html where url=\"www.yahoo.com\" and xpath=\'\//div[contains('@class,\"techSpecsTable/\")]\' '

how do I escape @class?

Était-ce utile?

La solution

You can escape the @class by doing

@@class

but I think you need to excape the '

var S = 'select * from html where url=\"www.yahoo.com\" and xpath=\'\//div[contains(\'@class,\"techSpecsTable/\")]\' '
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top