Hi there qwikad.com,
my javascript skills are rather amateurish but
this example does limit the word count to a
defined value...
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">
<title>word count</title>
<!--
The internal CSS should be transferred to an external file
<link rel="stylesheet" href="screen.css" media="screen">
-->
<style media="screen">
body {
background-color: #f0f0f0;
font: normal 1em / 1.62em sans-serif;
}
#words {
width: 100%;
box-sizing: border-box;
}
</style>
</head>
<body>
<input id="words" type="text">
<script>
(function( d ) {
'use strict';
var ary = [], keypresses = 0, spacecount = 0, wordcount = 10,
words = d.getElementById( 'words');
words.addEventListener( 'keypress',
function(e) {
ary.push( e.code );
if ( keypresses-1 !== -1 &&
e.code === 'Space' &&
ary[keypresses-1] !== 'Space' ) {
spacecount ++;
}
if ( spacecount >= wordcount ) {
words.disabled = true;
}
keypresses ++;
});
}( document ));
</script>
</body>
</html>
coothead