Anubhav Tiwari Anubhav Tiwari - 1 year ago 86
Javascript Question

Why is the function undefined?

var devigner = window.devigner = {};
devigner.create = function() { /*a generic method to create elements */
var element = function() {


The above code has an error for document.create.element being undefined while the typeof devigner is object which is correct , but typeof devigner.create is function.

when run in firebug

Answer Source

You need to do the function:


Also, create function should return an object with an 'element' value

create = function() {
    var element = ....
    return {element: element}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download