문제

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?

도움이 되었습니까?

해결책

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/\")]\' '
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top