Title: add a form value with '<br>' tag
Tags: javascript;tags;javascript-injection
Question: Is it possible to add a form value with <br&gt; tag in the jQuery ajaxForm?
I know it smells of script injection but it's a valid value. The string will be like this:
"Item1<br&gt;Item2<br&gt;Item3"
Comment: Wouldn't it work just adding `\n`?

Comment: Why does it smell of script injection?

Comment: @SergioAlen I'm being lazy cuz I need to output the text in html output. I can simply use a separator to replace '' and then replace the break tags back on the server before spitting it out. I was only wondering if this was possible/straightforward instead of doing string manipulation.


Here is another answer: If you are looking to insert <br&gt; tags to an element, you can use jQuery's .append() method to add it:
<div id="myDiv"&gt;
</div&gt;
JavaScript:
$("#myDiv").append("Item1<br&gt;Item2<br&gt;Item3");
Comment for this answer: No, it's actually a form that I need to add data to.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 3, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:10/06/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<javascript><tags><javascript-injection>', 'Title': "add a form value with '<br>' tag", 'ViewCount': 463, 'id': 39907378, 'user_AboutMe': '', 'user_AccountId': 1121439.0, 'user_DisplayName': 'h-rai', 'user_Reputation': 3306.0, 'user_Views': 248.0, 'user_id': 1109689.0}}