Javascript jQuery-在函数调用中使用当前对象
我想让这段代码正常工作,但是.css函数返回Javascript jQuery-在函数调用中使用当前对象,javascript,jquery,css,function,this,Javascript,Jquery,Css,Function,This,我想让这段代码正常工作,但是.css函数返回undefined $(".split-section-headings .ssh-cell") .html("This container has padding-top = " + $(this).css("paddingTop") ); 谢谢 如果没有类似于的东西,就不能使用$(this)。each()或在事件处理程序中: $(“.split section headers.ssh cell”).each(function(){ $(
undefined
$(".split-section-headings .ssh-cell")
.html("This container has padding-top = " + $(this).css("paddingTop") );
谢谢 如果没有类似于的东西,就不能使用$(this)
。each()
或在事件处理程序中:
$(“.split section headers.ssh cell”).each(function(){
$(this.html(“此容器具有padding top=“+$(this.css)(“padding”));
});代码>
显示该语句周围的代码。这是在事件处理程序中吗?没有围绕它的代码。这是正文末尾的
标记中的唯一语句。在开始这个问题之前,我已经通过以下操作获得了预期的结果:$(“.split section headers.ssh cell”).html(function(){return“this container has padding top=“+$(this).css(“paddingTop”)但是我觉得它太脏了。我可以问一下你的想法吗?:)谢谢