The following snippet triggers a "Conditional compilation turned off" warning in one of my views. Do you have an idea on how to fix it?
<script type="text/javascript">
$(document).ready(function () {
@RenderSection("JQueryDocumentReady",false)
});
</script>
I tried to insert a semicolon at the end of the render section statement but it didn't help.
Thank you.
NOTE: Answer accepted because of alternative suggestion to the question, not solution given for the problem in title.
I'm not 100% sure what Conditional Compilation has to do with being in a <script>
block, but I did find that wrapping the statements in parenthesis fixed the problem.
@(RenderSection("JQueryDocumentReady"))
I do think this method has a bit of code smell though. It's not a problem to just have a script section and assign things to document ready on each page. It really isn't going to save you much work, and it will force you to put javascript on views outside of script tags the way you have chosen to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With