Pregunta

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?

¿Fue útil?

Solución

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/\")]\' '
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top