【发布时间】:2015-07-19 00:31:37
【问题描述】:
我想在调用 mobileValidate() 后更改此占位符的颜色。
<input type="text" class="form-control" name="InputMobile" id="Mobile" placeholder="Enter Mobile Number" onblur="mobileValidate()"required>
JavaScript 函数是
function mobileValidate(){
var x = document.getElementById("Mobile");
if ((x.value).match(re)){
alert("mobile Number is valid");
}
else{
alert("mobile no is not valid");
x.value="";
x.placeholder.style.color="red";
}
}
【问题讨论】:
-
此链接可能对您有所帮助:stackoverflow.com/questions/2610497/…
标签: javascript html css