$(document).ready(function(){ $("input").change(function () { if($(this).val() == '') { $(this).css({ border:"1px dotted red;" }); } }) .change(); });