我有以下 jQuery 行,但使用.each()
.
$('span[data-private]').each(function () {
$(this).text($(this).attr("data-hidden"));
});
有没有更好的方法来编写这个看起来像这样的 jQuery:
// This doesn't work as $(this) refers to document not the current selector
// but it gives the idea of what I'm looking for. I want to reference the current
// selector
$('span[data-private]').text($(this).attr("data-hidden"));
在此先感谢您的帮助!