获取移动浏览器中 HTML 中的工具提示
当您单击具有标题属性的元素时,将附加一个包含标题文本的子元素。我们来看一个示例 −
对于 HTML −
<p> The <span class="demo" title="this is underscore">underlined</span> character. </p>
jQuery −
$("span[title]").click(function () {
var $title = $(this).find(".title");
if (!$title.length) {
$(this).append('<span class="title">' + $(this).attr("title") + '</span>');
} else {
$title.remove();
}
});以下是 CSS −
.demo {
border-bottom: 2px dotted;
position: relative;
}
.demo .title {
position: absolute;
top: 15px;
background: gray;
padding: 5px;
left: 0;
white-space: nowrap;
}
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP