我知道别人已经问过这个。 而且我尝试了其他人推荐的解决方案,但似乎并不奏效。删除输入字段jQuery的内容
这里是我的代码:
<!DOCTYPE HTML>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type='text/javascript'>
$('input:text').focus(
function(){
$(this).val('');
});
</script>
</head>
<body>
<form>
<input type="text" value="Text">
</form>
</body>
</html>
检查控制台查看是否有任何错误 –
我推荐阅读一个基本的jQuery教程,该教程解释了如何设置jQuery:http://learn.jquery.com/about-jquery/how-jquery-works/。 –
我在控制台得到这个错误:未捕获TypeError:对象#