0

私はこれまで少しでも運がなかったので、私は何かを捨てると思った。clickイベントソースがtheadから来ているかどうかを確認

theadではなく、tbodyからのソースである場合にのみ、Angularディレクティブでclickイベントの機能が実行される必要があります。私はこの情報を得るためにいくつかのルートを試しましたが、私は正しい構文を得ることができません。

ご迷惑をおかけして申し訳ございません。ここに私の最新の/最善の試みがあります。私はあなたに何が起こっているのかを伝えます。

/* Linker for the directive */ 
var linker = function (scope, elm, attrs) { 
    window.setTimeout(function(){ 
     elm.find('table tbody tr.uib-weeks td button span.text-info').closest('tr').find('button').addClass('chosenReportWeek'); 
    }, 1000); // This is a hack until we can find the proper load/render event   

    elm.on('click', function(event) { 
     if(event.target.parent.indexOf('thead') === -1){ 
      elm.find('table tbody tr.uib-weeks button.active').closest('tr').find('button').addClass('chosenReportWeek'); 
     }     
    }); 
}; 
+0

'(。$(event.target).closest( 'TBODY')の長さ){...' – adeneo

+0

が持っていた場合は ' 'thead要素にそれを変更するには'' closest'で動作しますが、動作します。ありがとう! – NealR

+0

あなたはようこそ! – adeneo

答えて

0
以下

正しい構文:

if($(event.target).closest('thead').length === 0) 
関連する問題