JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<input type="text" />
</form>
JavaScript
$(document).ready(function(){
$('input').change(function(){
var count = 0;
var pass = $(this).val();
count += /[a-z]/.test(pass) ? 1 : 0;
count += /[A-Z]/.test(pass) ? 1 : 0;
count += /\d/.test(pass) ? 1 : 0;
count += /[^\w\d\s]/.test(pass) ? 1 : 0;
(count>2 & !/[\s]+/.test(pass)) ? alert('right'):alert('wrong');
});
});