[jQuery] Problems appending inputs with quotes in the value

[jQuery] Problems appending inputs with quotes in the value


I am trying to append an input box with quotes in the value, and no
matter how many escapes I put on the quote (thinking maybe the escapes
needed to be escaped), it fails to insert properly, like jQuery just
ignores all escapes and goes straight for the quote.
i.e.- If I try something like the following:
$('form').append('<input type="text" name="foo" value="Quote - \"This
is a quote\"" />');
The element that gets appended to the form has the following html:
<input type="text" name="foo" value="Quote - "This is a quote"" />
Obviously, this is incorrect, and I can't get around this, it's user
driven content, and I can't just ask my users to stay away from
quotes.
Is there anything I can do to rectify this issue? Besides going in
and editing the value after insert?