vb.net 如何注释掉与服务器标记混合的 javascript 代码块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19320752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I comment out a block of javascript code mixed with server tags
提问by Niklas
Say I have this piece of javascript/jQuery code and I want to comment out the marked code block.
假设我有这段 javascript/jQuery 代码,我想注释掉标记的代码块。
<script>
function checkValues() {
// Important function
}
$(document).ready(function () {
$(".item").click(function () {
// Important action
});
/* I want to comment this block out, from here...
$("#<%=Application("InstID")%>").blur(function () {
});
$("#<%=Application("ComID")%>").blur(function () {
});
...to here */
});
</script>
But the server tags won't allow a regular comment block with /* comment */. Is there another way to make a code block in this case?
但是服务器标签不允许带有/* comment */. 在这种情况下,还有其他方法可以制作代码块吗?
Visual studio won't recognize the Ctrl+K+Ceither.
Visual Studio 也不会识别Ctrl+ K+ C。
回答by Joe Enos
You can wrap them with the comment block of <%-- --%>:
您可以使用以下注释块包装它们<%-- --%>:
$(document).ready(function () {
$(".item").click(function () {
// Important action
});
<%--
$("#<%=Application("InstID")%>").blur(function () {
});
$("#<%=Application("ComID")%>").blur(function () {
});
--%>
});

