0

I have a piece of jQuery code in partial view as:

        //Reset values 
        ResetAllFields();
        HideDiv();
        //Hide buttons
        $('#btn-id').hide();

The two lines //Reset fields and //Hide buttons are successfully commented. But, even after I comment out the line as:

//HideDiv();

and execute it in debugger mode in chrome, pressing F12, the function gets called, i.e. the line is not commented. I also tried commenting it out as @* HideDiv() *@ but in vain.

Am I missing something here? Or, is there a different syntax ?

b.g
  • 371
  • 1
  • 2
  • 18

3 Answers3

0

You could try this syntax /* your javascript here */ but I would recommend you review this thread JavaScript in partial views and not include javascript in a partial view at all.

Community
  • 1
  • 1
Neo
  • 3,149
  • 6
  • 31
  • 43
  • besides what you have tried, and what I suggested there is no other way I know of to comment out JavaScript. I would recommend attempting to follow the pattern identified in the thread I provided. – Neo Oct 24 '16 at 13:19
0

//your javascript here or /* your javascript here */ do work! It seems that you missed the <script> tag in your code.

If so, use:

@* your javascript here  *@
eWilli
  • 97
  • 8
0

Please try this,

@://HideDiv();

Note the "@:"

Mihai Alexandru-Ionut
  • 44,345
  • 11
  • 88
  • 115