如果 this 是 HTMLDivElement,我该如何避免这样做?
$('#' + $(this).id + " > p").foo();
做类似的事情:
($(this) + $( " > p")).foo();
最佳答案
$(this).children('p').foo();
关于jquery - 在 jQuery 中向 this 添加字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2754405/