jQuery不允许我添加$(this).html(); [英] Jquery won't let me add $(this).html();
本文介绍了jQuery不允许我添加$(this).html();的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望有一个比我聪明的人能弄清楚这一点,我觉得我真的很亲近...
I am hoping someone smarter than me can figure this out, I feel like I am really close...
在此处查看: http://jsfiddle.net/9rjW3/4/
Check it out here: http://jsfiddle.net/9rjW3/4/
这是我添加的Jquery
This is the Jquery I added
$('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"更改为单元格的值...
It works, but the only problem is I haven't figure out how to change "this" to the value of the cell...
当我尝试更改时
return 'this';
到
return $(this).html();
这行不通,有什么建议吗?
It doesn't work, any suggestions?
推荐答案
我个人建议:
$('tr + tr td:nth-child(3) span').html(function(i,h){
return $(this).height() > 18 ? h.replace(/@/g, '\n@') : h;
});
这篇关于jQuery不允许我添加$(this).html();的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文