JSFiddle - React, Tailwind, and code Playground
by Roy Howie
HTML
<p>Enter no more than 10 words:</p>
<textarea id="myText"></textarea>
CSS
textarea {
width: 300px;
height: 100px;
}
JavaScript
var maxWords = 10;
$("#myText").on("paste", function (event) {
setTimeout(function () {
var text = $("#myText").val().split(" ");
while (text.length > maxWords) {
text.pop();
}
$("#myText").val(text.join(" "));
}, 0)
})