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?

Was it helpful?

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/\")]\' '
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top