【问题标题】:Why doesn't the text inside my text field disappear on click?为什么我的文本字段中的文本在单击时不会消失?
【发布时间】:2012-02-18 12:36:55
【问题描述】:

在下面的例子中

http://twitter.github.com/bootstrap/base-css.html#forms

有一个文本字段,其中包含文本“键入一些东西...”,点击后会消失

我在下面包含了几乎相同的代码

<!DOCTYPE html>

<html lang="en">    
<head>  
    <meta charset="utf-8">    
    <title></title>    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">    
    <meta name="description" content="">    
    <meta name="author" content="">    
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>    
    <link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">    
    <link href="http://twitter.github.com/bootstrap/assets/css/docs.css" rel="stylesheet">    
</head>    
<body>    
<input type="text" class="span3" placeholder="Type something…"> <span class="help-inline">Associated help text!</span>the
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>

<script src="http://twitter.github.com/bootstrap/1.4.0/bootstrap-modal.js"></script>

</body>

</html>

谁能告诉我为什么点击后我的文字没有消失?

【问题讨论】:

  • 在我的浏览器(Safari、Chrome、Firefox)上有效:一旦我单击或以其他方式聚焦文本字段,占位符文本就会消失。你用的是哪个浏览器?

标签: javascript html


【解决方案1】:

我使用的是 Chrome,点击后文本不会消失。写入后消失。当您删除输入时,占位符会再次出现。

【讨论】:

    猜你喜欢
    • 2022-09-27
    • 2010-12-10
    • 2019-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多