php - Yii Bootster - TbTabs Change Tab Event -


how can control change of tab event when using tbtabs in yii bootter?

here code (but didn't alert when have changed tab):

$this->widget('bootstrap.widgets.tbtabs', array(         'type' => 'tabs',         'tabs' => array(             array('label' => 'trainer modules', 'content' => 'content tab 1',             array('label' => 'default modules', 'content' => 'content tab 2',         ),         'events' => array(             'change' => "js:function(){alert('123');}"         )     )); 

just future reference, 1 solution control tab clicks on tbtabs assign id each tab , handle event using clientscript, here how works:

assign id each link this:

$this->widget('bootstrap.widgets.tbtabs', array(     'type'=>'tabs',     'placement'=>'above', // 'above', 'right', 'below' or 'left'     'tabs'=>array(         array('label'=>'section 1', 'active'=>true, 'linkoptions' => array('id'=>'link1')),         array('label'=>'section 2', 'linkoptions' => array('id'=>'link2')),     ), )); 

then register js using cclientscript

yii::app()->clientscript->registerscript("link1click", "$('#link1').click(function(){alert('link1 clicked');})"); yii::app()->clientscript->registerscript("link1click", "$('#link2').click(function(){alert('link2 clicked');})"); 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -