level 2
灬耗丶子灬
楼主
<!DOCTYPE html>
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("input").focus(function(){
$(this).attr("value",'');
});
$("input").blur(function(){
if ($"input" ==null) {$(this).attr("value",'请填写')};
});
});
</script>
</head>
<body>
Name: <input type="text" name="fullname" value="name"><br>
Email: <input type="text" name="email" value="Email" >
</body>
</html>
我想实现 name 和 email 栏里,点进去字符消失,点出来,如果为空 就显示“请输入”
但是现在实现不了,求大神指教
2016年03月09日 09点03分
1
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("input").focus(function(){
$(this).attr("value",'');
});
$("input").blur(function(){
if ($"input" ==null) {$(this).attr("value",'请填写')};
});
});
</script>
</head>
<body>
Name: <input type="text" name="fullname" value="name"><br>
Email: <input type="text" name="email" value="Email" >
</body>
</html>
我想实现 name 和 email 栏里,点进去字符消失,点出来,如果为空 就显示“请输入”
但是现在实现不了,求大神指教