Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Pierre on Apr 06, 2009 05:42
open dhtmlx forum
Tabbar How to add select or onClick event on tabbar create from HTML

Hi !,

I've created a tabbar from HTML and i would like to fire a javascript event when a tab is clicked. I've tried adding "onClick" in my div tag but it did not work. I also tried something like this:

tabbar = new dhtmlXTabBar('client_tab','top');
            tabbar.setOnSelectHandler(function(idn, ido){
alert('Clicked');
                     return true;
});

Also did not work since my tab is created from html.

What did i need to add to make it works ?

Thanks !
Answer posted by Alex (support) on Apr 06, 2009 06:05

Hello,

You can use the following method to call tabbars methods:

<div oninit="someAction()" class="dhtmlxTabBar" id="tabbar" ...>
  ...
 </div>

<script>
  function someAction(){
  tabbar.setOnSelectHandler(function(idn, ido){ 
  alert('Clicked'); 
  return true;
  });
 }
</script>

Where tabbar is the container id.