Click http://jsfiddle.net/4y1b1j8g/13/ to see the result. When I input a value in the input and press Enter, the value will replace dog value. But that is not what I want. I want to keep the value. for example, enter cat, it will become dog cat, enter mouse, it will like dog cat mouse. How can I do that?Appreciate.
$( "#input" ).keydown(function( event ) {
if ( event.which == 13 ) {
event.preventDefault();
//put input value into div
var value=$('#input').val();
$('#test').text(value);
}
});
<div class="test" id="test">dog</div>
<input type="text" id="input"/>
</div>