jquery replaceWith variable returns undefined
<pre><code>var item='&lt;input class="item" type="text" value="1"/&gt;';
$('#div1').replaceWith(item);
var val1 = $('.item').val();
</code></pre>

<p>This returns undefined.I think it has something to do with replacing the DOM element but I don't know how to fix this.</p>
