Frage

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?

War es hilfreich?

Lösung

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/\")]\' '
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top