Artur_Hopf,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(function() {
$('.key-button-new').click(function(){
var key = this.innerHTML;
var target = document.querySelector("#keyboard-input"),
text = target.value,
caretPos = target.selectionStart,
caretPosEnd = target.selectionEnd;
target.value = text.substr(0, caretPos) + key + text.substr(caretPosEnd);
caretPos += key.length;
target.focus();
target.setSelectionRange(caretPos, caretPos)
});
});
</script>
</head>
<body>
<input id="keyboard-input" type="text">
<button type="button" class="key-button-new">1</button>
<button type="button" class="key-button-new">2</button>
<button type="button" class="key-button-new">3</button>
</body>
</html>