[英]Jquery function should work with subclasses, not for all classes
A have a this jquery function....一个有这个 jquery function....
$(".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'));
});
});
this function need working only for subclasses, current.rolled-wrap (eg .rolled-wrap (this).button-text span)..... however clicking on one class, result summbit for all.button-text span.... I do not know what to do, I will be grateful for any help.这个 function 只需要为子类工作,current.rolled-wrap(例如 .rolled-wrap (this).button-text span)......但是单击一个 class,结果 summbit for all.button-text span.. ..我不知道该怎么做,我将不胜感激。 thank you in advance
先感谢您
To look inside the target element use .find()
要查看目标元素内部,请使用
.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'));
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.