 <p>jQuery's <a href="http://api.jquery.com/val/" rel="nofollow"><code>.val()</code></a> method is both a getter and a setter.</p> <p>Try this:</p> <p><code>$('input[name="x"]').val($hello);</code></p>