单击时向输入字段的现有值添加附加值 - jQuery

ber*_*nte 2 jquery click

我得到了带有标签按钮的输入字段

<input id="demooutput" type="text" size="15" value="My Text" name="demo" />
<span class="demooutput">
    <a href="#" class="button orange"> A</a>
    <a href="#" class="button orange"> B</a>
    <a href="#" class="button orange"> C</a>
    <a href="#" class="button orange"> D</a>
    <a href="#" class="button orange"> E</a>        
</span>
Run Code Online (Sandbox Code Playgroud)

使用此 jQuery 代码,我将值添加到输入

$('.demooutput a').click(function(){
    $('#demooutput').val($(this).html());
    return false;
});
Run Code Online (Sandbox Code Playgroud)

但我每次点击按钮都会清除我现有的价值

我想将按钮中的值另外添加到输入中的现有值

我想要的例子

My Text A (by click on A)
My Text A B (by click on A and B)
My Text B C E (by click on B, C and E)
and so on..
Run Code Online (Sandbox Code Playgroud)


查看JSFIDDLE上的演示

小智 5

$('#demooutput').val($('#demooutput').val() + $(this).html());