Home > OS >  When I use & operand in html textarea, it doesn't appear
When I use & operand in html textarea, it doesn't appear

Time:01-19

I have a text area field as shown below, when I enter a string like that : testing123!&aaa it only returns testing123!

<span >
                    @Html.TextAreaFor(m => m.Nr2FieldComment, 4, 43, new { @class = "" })
                </span>

CodePudding user response:

I'm assuming you're having this issue with your ajax request, if true, please use encodeURIComponent like bellow;

var commentClean = encodeURIComponent(comment);

CodePudding user response:

The '&' character has special meaning as the lead character in specifying special character values. Use &amp; instead and it should appear. Lookup all the special character codings to see how and when you need this notation.

  • Related