我希望比我聪明的人能够解决这个问题,我觉得我真的很接近......
在这里查看: http://jsfiddle.net/9rjW3/4/
这是我添加的Jquery
$('tr:gt(0)').each(function () {
$(this).find('td:eq(2)').html(function () {
if($('span').height() > 18)
return $(this).html().replace('@','\n@');
else
return 'this';
})
})
它有效,但唯一的问题是我还没有弄清楚如何将“this”更改为单元格的值...
当我尝试改变
return 'this';
至
return $(this).html();
它不起作用,有什么建议吗?
最佳答案
我个人建议:
$('tr + tr td:nth-child(3) span').html(function(i,h){
return $(this).height() > 18 ? h.replace(/@/g, '\n@') : h;
});
关于javascript - Jquery 不允许我添加 $(this).html();,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22972791/