Connect to bootstrap widget event in view

Hi,

I tried to connect to an event of the bootstrap tab widget from yii.

In the documentation it ill be possible in the following way:




$tabs = new \yii\bootstrap\Tabs([

    'id'=>'myTab',

    'items' => [['label'=>'a', 'content'=>'b'], ['label'=>'c', 'content'=>'d']]

]);


$tabs->on('shown.bs.tab', function ($event)

{

    var_dump('trigger done');

});


echo $tabs->run();



But this does not work for me. Via javascript, I can see, that the event will be fired, but only, if I embeds this in the $(document).ready function:




$(document).ready(function()

{

    $(document).on('shown.bs.tab', function (e) {

        alert('TAB CHANGED');

    });

})



Does anybody have an idea whats wrong?

Thank you in advance.

Regards

Markus