2,引入js 。添加如下代码
function isPlaceholer(){
var input = document.createElement('input');
return "placeholder" in input;
}
if( isPlaceholer() ) {
console.log("1")
}else {
console.log( "2" );
if( $('#search').val()=="" ){
$('#search').css({
"color" : "#ccc"
})
$('#search').val("输入设备编号进行搜索");
}
$('#search').focus(function () {
$('#search').css({
"color" : "#000000"
})
if( $(this).val()=="输入设备编号进行搜索" ){
$(this).val("");
}
})
$('#search').blur(function () {
if( $(this).val()=="" ){
$(this).val("输入设备编号进行搜索");
$('#search').css({
"color" : "#ccc"
})
}else {
$('#search').css({
"color" : "#000000"
})
}
})
}