私は次の声明を持っています
if(play == '4'){
$(this).removeAttr('data-playa');
$(this).attr("data-pausea",'5');
}
基本的に、現在の要素のに置き換えdata-playa="4"
ますdata-pausea="5"
。$(this)
article-play so のクラスを持つ現在のアンカータグを参照し$(article-play)
ます。$(article-play)
現在の要素を除く、ページ上のすべての要素に以下を適用するには、このコードを編集する必要があります。
$(article-play).removeAttr('data-pausea');
$(article-play).attr("data-playa",'4');
したがって、論理的にはこのようになります
if(play == '4'){
// Apply this to current .article-play
$(this).removeAttr('data-playa');
$(this).attr("data-pausea",'5');
// Apply this to all other .article-play on a page
$(article-play).removeAttr('data-pausea');
$(article-play).attr("data-playa",'4');
}