現在、クリック時に子要素の色を変更しようとしています。親要素は別のページにリンクしています。stopPropogation が機能することを望んでいましたが、そうではありません。以下は私のjQueryコードです:
$('.child').click(function(){
if($(this).hasClass('pinned')){
$(this).removeClass('pinned')
}
else{
$(this).addClass('pinned')
}
});
// disable parent link when pinning
$('.child').click(function(event){
event.stopPropagation();
});
問題がある場合は、アンカー タグで祖父母を囲みます。
どこが間違っていますか?