简体   繁体   中英

How to escape a double-quote in inline c# script within javascript?

How can I make the following inline c# work within javascript? I have had no luck with escape characters, but I am sure I'm just doing something wrong.

var inputId = "<%= applicationForm.FindControl("myInput").ClientID %>";

您可以在JavaScript中简单地使用单引号定义String文字

var inputId = '<%= applicationForm.FindControl("myInput").ClientID %>';

your line should work. try this too:

var inputId = '<%= applicationForm.FindControl("myInput").ClientID %>';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM