Php jQuery筛选器锚定标记位于<;td>;
我需要的是,对于长文本,我已经给出了溢出隐藏和文本溢出省略号 当我悬停时,表示所有的Php jQuery筛选器锚定标记位于<;td>;,php,jquery,Php,Jquery,我需要的是,对于长文本,我已经给出了溢出隐藏和文本溢出省略号 当我悬停时,表示所有的值在悬停时都需要显示在标题中,除了标记函数showinTitle($Object){ $(document).ready(function() { $(".table_class table td").hover(function() { $(".table_class table td a").filter(function() { showinTitle($(this
值在悬停时都需要显示在标题中,除了
标记函数showinTitle($Object){
$(document).ready(function() {
$(".table_class table td").hover(function() {
$(".table_class table td a").filter(function() {
showinTitle($(this));
});
});
});
function showinTitle($Object){
$Object.prop('title', $Object.html());
}
var title=$Object.html();
var wrapped=$(“”+title+“”);
wrapped.find(“a”).remove();
$Object.prop('title',wrapped.html());
}
jQuery函数用于根据条件从集合中删除元素,因此您不应该使用它来解决此问题
如果td
元素的内容只是带有一些锚定标记的文本,并且您希望为类似于title with link
的td显示标题“title with link”
,则您可以使用td的文本生成标题:
function showinTitle($Object){
var title = $Object.html();
var wrapped = $("<div>" + title + "</div>");
wrapped.find("a").remove();
$Object.prop('title', wrapped.html());
}
如果您试图使每个td的标题显示除锚定标记内容以外的所有内容(即,如果您想为类似td的标题显示带有链接的标题,则需要执行类似于Arvind建议的操作:
$(document).ready(function() {
$(".table_class table td").each(function() {
$(this).prop('title', $(this).text())
})
})
$(文档).ready(函数(){
$(“.table_class table td”)。每个(函数(){
var contents=$(“”+$(this.html()+“”);
contents.find(“a”).remove();
$(this.prop('title',contents.text())
})
})
当文档加载时,它会循环遍历每个td,并创建它的临时克隆。然后从克隆中删除锚定标记,并将td的标题设置为克隆的(已清理)内容
$(document).ready(function() {
$(".table_class table td").each(function() {
var contents = $("<td>" + $(this).html() + "</td>");
contents.find("a").remove();
$(this).prop('title', contents.text())
})
})