JSFiddle - React, Tailwind, and code Playground

HTML

<form id="form_data" name="form_data" action="http://itcraft.com.ua/html-css-internship-2016-0439599340/form-controller.php" method="post">
		<label>
			<p>Some text</p>
			<input id="text" name="text" type="text" class="default valid">
		</label>
</form>

CSS

.default{
	color: #47494b;
	border: 1px solid #47494b;
	border-radius: 4px;
	background: transparent;
}
.valid{
	color: #5d9f81;
	border-color: #5d9f81;
}
.invalid{
	color: #fff;
	border-color: rgb(231,99,94); 
}

JavaScript

$(document).ready(function () {

 console.log($(this));

//highlight the text in label if input has class
if($('input').hasClass('valid')){
	$(this).closest("label").addClass('valid')
}
if($('input').hasClass('invalid')){
	$(this).closest("label").addClass('invalid')
}
});