Access tabbar obj from js when init from html


#1

Hi forum,
I’m having trouble when I try to access to a tabbar obj created inside html. Following the online demo code, I wrote this html code:

   <div id="tab_parent" class="dhtmlxTabBar" style="width:100%; height:200px;">
                <div id="tab_files" name="Files" selected="1" style="display: none;"> 
                </div>
                <div id="tab_folder" name="Folder" style="display: none;">
                </div>
   </div>

On my js:
var mt = document.getElementById(“tab_parent”); # tried also with tab_files or tab_folder
mt.tabs(“tab_files”).attachList( …
and I receive:
tab_parent.tabs is not a function
with a:
console.log(mt);
I see:

that it's right to see since I defined tab_parent as dhtmlxTabBar class, but how to access to the dhtmlxTabBar obj instance?

Thanks

p.s. i’m using the last dhtmlx code just downloaded


#2

You should assign a name to your tabbar object during its creation:

var mt= new dhtmlXTabBar(...