javascript - Format code in Razor section visual studio -


i have project asp.net mvc in visual studio 2017 (enterprise edition) in layout page have 3 sections

  <script type="text/javascript">     $(document).ready(function () {          if(checkuserhavemobilephone) {              @rendersection("scriptsphone", false)         }         else {              @rendersection("scriptspc", false)         }                    @rendersection("scripts", false)      }); </script> 

and in view have code (and work)

<script type="text/javascript"> @section scripts {     $(window).resize(function () {      }); }    </script> 

http://imgur.com/ks8olfq

but when add if-statement section don't work

<script type="text/javascript"> @section scripts {      $(window).resize(function () {         if (parseint($(window).width()) <= 800) {             alert("alert");         }     });  }    </script> 

http://imgur.com/a/zqiwj

after syntax error

expected character '}'

<script type="text/javascript"> @section scripts { <text>     $(window).resize(function () {         if (parseint($(window).width()) <= 800) {             alert("alert");         }     }); </text> }    </script> 

try text tag, should working.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -