Jquery 函数应与 sub类 一起使用,但不适用于所有 类

Jquery function should work with subclasses, not for all classes

A 有一个 jquery 函数....

$(".rolled-wrap").on('click', function() {
     $(this).each(function() {
        $('.button-text span').text($('.button-text span').data('hover'));
        $('.button-text span').attr("data-hover", $('.button-text span').data('hover'));
    });
}); 

此功能只需要在子classes 上工作,当前.rolled-wrap(例如.rolled-wrap (this) .button-text span)......但是点击一个class, result summbit for all .button-text span....我不知道该怎么做,我将不胜感激任何帮助。提前谢谢你

要查看目标元素内部,请使用 .find()

$(".rolled-wrap").on('click', function() {
     $(this).find('.button-text span').text($('.button-text span').data('hover'));
     $(this).find('.button-text span').attr("data-hover", $('.button-text span').data('hover'));
});