0

I have a variable say:

var stringArray   = ["A","B","C","D","E","F"];

Now placing this equal to a Javascript variable like

<script>
   var ticks = @stringArray;
</script>

But in variable ticks " is replace with &quot ;

1 Answer 1

2

You can use the HtmlHelper.Raw method to wrap HTML markup in an HtmlString instance so that it is interpreted as HTML markup, or in your case, as JavaScript:

<script>
  var ticks = @Html.Raw(stringArray);
</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.