JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-2.2.2.js"></script>
<body>
<form>
<input type="text" class="monitored"/>
</form>
</body>
JavaScript
$( document ).ready(function() {
$('.monitored').keyup(function(){
if ($('.monitored').val().length > 23){
// trim and send the value to the server
$.post( "listener.php", { value: $('.monitored').val().substring(0,23)} );
// empty the input
$('.monitored').val('');
// maybe add delay?
}
});
});