Looking how to use Functions with Functions, using prototype
<p>I'm just kind of horsing around, trying to mimick certain jQuery functions (trying to write the vanilla <code>javascript</code> for the jQuery functions) I've made up this here</p>

<pre><code>function ezWork(element) {
    if (typeof element === 'string') {
        document.getElementById(element);
        console.log('Got element');
    }
}


ezWork.prototype.on = function(event, callback) {
    if (typeof event === 'string') {

        if (event === 'click') {
            if(window.addEventListener) {
                element.addEventListener('mousedown', callback);
                alert('addEventListener called');
            } else if (window.attachEvent) {
                element.attachEvent('onmousedown', callback);
            } else {
                element.onmousedown = callback;
            }
        }
    }
}

ezWork('click').on('click', function(e) {
    e.preventDefault();
    alert('Worked');
});
</code></pre>

<p><a href="http://jsfiddle.net/aJmMa/" rel="nofollow">http://jsfiddle.net/aJmMa/</a></p>

<p>I'm just curious why I get .on is not defined (I'm doing this off how I think it should be done, and not whether or not if I know this is the proper way to do this, I'm just trying to learn, what is the correct way of doing what I'm trying to do to add functions to functions?)</p>

<p>Thanks a lot for the help!</p>

<p>The error I get now is, '.on' is not defined.</p>
