How do I serialize an javascript array into html attribute and fetch it back with jquery?
<pre><code>var arr=[...];

var html = '&lt;input attr="' + serialize(arr) + '"&gt;';
</code></pre>

<p>I can't simply <code>join(' ')</code> the <code>arr</code> as there may be white space or other special characters.</p>

<p>How do I do it properly?</p>
