Hi letstry,
You need to check Length of your input values. So I have set length as 3 and afer "vertical bar" I have set one blank space(Spacebar).
Please refer below demo sample.
HTML
<input type="text" id="txtDetails" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('#txtDetails').on("keyup", function (e) {
if ($(this).val().length == 3) {
if (e.key === ' ' || e.key === 'Spacebar') {
$('#txtDetails').val($('#txtDetails').val() + "| ");
}
}
});
});
</script>
Demo