electrope
electrope

Reputation: 3

JavaScript function not defining properly

I've looked every where for a solution to this but found nothing. For some reason when I try to call a function it says that it is undefined.

function removeBusiness(num){ 
    companies.splice(num, 1); //Removes a company from the companies array.
    tabCreate(tabsbody[0]); //Reloads the current tab that you are in.
};

var tabsbody = ["tab_name", "element", 0/*is active*/];
var tabs;
function TabCreate(tab){
    switch(tab){
        case "contract":
            if( tabsbody[2] == 1 ){tabsbody[1].remove(); //Removes old tab page and builds the requested one.
                tabs.style.backgroundColor = "#648a64";
            }else{ tabsbody[2] = 1;};
            if( tabsbody != "contract"){
                tabsbody[0] = "contract";
                var submain = document.createElement("div");
                    submain.style.height = "70vh";
                    submain.style.width = "98%";
                    submain.style.margin = "auto";
                    tabsbody[1] = submain;
                    document.getElementById("main").appendChild(submain);
                tabs = document.getElementById("contractlisten");
            };
        break;
    };
};
removeBusiness(0);

This is some of my code but I removed a lot of the cases to make it easier to read. I am calling removeBusiness after page has loaded plus 3 seconds. Any help?

Upvotes: 0

Views: 54

Answers (1)

id.ot
id.ot

Reputation: 3141

Use a capital "T" when calling the 'TabCreate' function.

Update

Javascript is case-sensitive, http://en.wikipedia.org/wiki/JavaScript_syntax#Case_sensitivity.

Upvotes: 1

Related Questions