Edit This Code:
<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>  
<style>
input.ng-invalid {
    background-color:pink;
}

input.ng-valid {
    background-color:lightgreen;
}

</style>
<body ng-app="">

<p>Try writing in the input field:</p>

<form name="myForm">
<input name="myName" ng-model="myName" required>
</form>

<p>The input field requires content, and will therefore become green when you write in it.</p>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy