JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" />
JavaScript
$('input').on('keyup', function(e) {
if (e.which !== 32) {
var value = $(this).val();
var noWhitespaceValue = value.replace(/\s+/g, '');
var noWhitespaceCount = noWhitespaceValue.length;
if (noWhitespaceCount % 3 === 0) {
// Call API
console.log('API Called');
}
}
});