I have the following code in my view of an asp.net-mvc site:
<input type="hidden" id="test" name="riskIssues[0].Reason" value="<% = risk.Reason %>" />
The issue is that if there is a double quote inside the risk.Reason variable lets say the reason is a string that is something like:
We need them to "ask" us first
and then i try to read the value using jquery ($("#test").val(), i only get the text that is before the double quote (in the example above, i would get
We need them to
What is the correct way to encode this so I can read the whole string including the double quotes and everything after
You can use <%: risk.Reason %>
to encode your text.