JSFiddle - React, Tailwind, and code Playground
HTML
<form onsubmit="return validateForm()">
<input type="text" value="" id="title_input" />
<input type="submit" />
</form>
JavaScript
function validateForm() {
var titleEl = document.getElementById('title_input');
var title = titleEl.value;
var upperLength = 0;
for (var i = 0; i < title.length; i++) {
upperLength += (title[i] === title[i].toUpperCase() ? 1 : 0);
}
if (upperLength === title.length) {
alert('Invalid title');
return false;
}
return true;
};