Fill in Input Field by Clicking Link - jQuery
<p>How might someone fill in an input field with some text using jquery by clicking that text?</p>

<p>The text is generated dynamically so the value is not know ahead of time.</p>

<p>For example with: </p>

<pre><code>&lt;input id="tag" type="text" name="tags" value=""&gt;

&lt;p&gt;
    &lt;a class="tag"&gt;aaa&lt;/a&gt;&lt;br/&gt;
    &lt;a class="tag"&gt;bbb&lt;/a&gt;&lt;br/&gt;
    &lt;a class="tag"&gt;ccc&lt;/a&gt;&lt;br/&gt;
    &lt;a class="tag"&gt;ddd&lt;/a&gt;&lt;br/&gt;
    &lt;a class="tag"&gt;eee&lt;/a&gt;
&lt;/p&gt;
</code></pre>

<p>I'm try with this</p>

<pre><code>$('a.tag').live('click', function(e){
    $('#tag').val(this.innerHTML);
    return false; 
});
</code></pre>

<p>but this will put only one tag in the input field,  i need to put something like this</p>

<pre><code>&lt;input id="tag" type="text" name="tags" value="aaa, bbb, ccc, eee"&gt;
</code></pre>

<p>Here is working example
<a href="http://jsfiddle.net/Kaf3V/4/" rel="nofollow">http://jsfiddle.net/Kaf3V/4/</a></p>
