adding additional value to existing value of an inputfield on click - jQuery

click, jquery

Solution

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

Problem

i got this inputfield with tag buttons ``` <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> ``` with this jQuery code i add the values to the input ``` $('.demooutput a').click(function(){ $('#demooutput').val($(this).html()); return false; }); ``` but i clear my existing value with every click on the button i want to add the value from the button additionally to the existing value from input Example who i want it ``` 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.. ``` See a Demo on JSFIDDLE

Original source