js判斷是否input的輸入值為空后為輸入框設(shè)置紅色提醒方法:
form input 代碼
<input id="name" type="text" name="username" placeholder="請輸入姓名" >js代碼
var name=$("#name").val();
if (name == '' || name == undefined || name == null){
//alert("請輸入姓名");
$("#name").css('borderColor','red'); //添加css樣式
}else {
$("#name").css('borderColor',''); //取消css樣式
}我是有底線的
掃描二維碼手機查看該文章
文章引用:http://www.qingbaosc.com/news/webzhishi/1332.html




