<input type="text"title="likethis()"maxlength="200"placeholder="This will allow only 200 words">
// Add event handler for event that can be cancelled and prevent excessive data
// from ever getting into the textbox
document.getElementById("input").addEventListener("keypress", function(evt){
// Get value of textbox and split into array where there is one or more continous spaces
var words = this.value.split(/s+/);
var numWords = words.length; // Get # of words in array
var maxWords = 2;
// If we are at the limit and the key pressed wasn't BACKSPACE or DELETE,
// don't allow any more input
if(numWords > maxWords){
evt.preventDefault(); // Cancel event
}
});