1

How do I add this to a html text input.

var s = '>>>>>>>  """""""""""""';

How can I escape these characters so that it does not break the the HTML

var addMe = '<input type="text" value="' + s + '" />';

This is how it looks when its dynamically added with jquery

<input type="text" ??="" value=""/>
Hello-World
  • 9,277
  • 23
  • 88
  • 154

1 Answers1

4

Use .attr('value', ...) to add arbitrary text to an element's value without needing to escape it.

Alnitak
  • 334,560
  • 70
  • 407
  • 495