我知道其他人已经问过这个问题。而且我尝试了其他人推荐的解决方案,但似乎不起作用。
这是我的代码:
<!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>