Write a JavaScript program to change color of textbox if empty string submitted.
<html>
<head>
<title>Change Color of Textbox if Empty String Submitted</title>
<script>
function fun()
{
txt = document.getElementById('t1').value
if(txt.length == 0)
document.getElementById('t1').style.borderColor = "red"
}
</script>
</head>
<body>
<input type="text" id="t1">
<input type="button" value="Submit" onclick="fun()">
</body>
</html>
