jQuery proxy functions and events
<p>Look at the following jquery plugin I have made:</p>

<pre><code>(function($) {

    //
    // Constructor.
    //

    var Tb = function(element, options) {
        var self = this;

        this.options = options;
        this.$element = $(element);
        this.$input = $(element).find('.tb-input');
        this.$label = $(element).find('.tb-label');

        this.$element
            .proxy('click', this.$input.click)
            .proxy('val', this.$input.val);
    };

    Tb.prototype = {
        constructor: Tb
    };

  //
    // jQuery plugin.
    //

    $.fn.tb = function(option) {
        return this.each(function() {
            var $this = $(this)
                , data = $this.data('tb')
                , options = $.extend({}, $.fn.tb.defaults, $this.data(), typeof option == 'object' &amp;&amp; option);

            if (!data) {
                $this.data('tb', (data = new Tb(this, options)));
            }

            if (typeof(option) == 'string') {
                data[option]();
            }
        });
    };

    $.fn.tb.defaults = {};
    $.fn.tb.Constructor = Tb;

})(window.jQuery);
</code></pre>

<p>HTML (demo)</p>

<pre><code>&lt;div id="tb-user-name" class="tb"&gt;
    &lt;label class="tb-label"&gt;This is the placeholder&lt;/label&gt;
    &lt;input type="text" class="tb-input" /&gt;
&lt;/div&gt;
</code></pre>

<p>javascript init:</p>

<pre><code>$('#tb-user-name').tb();
</code></pre>

<p>So basically If I do this:</p>

<pre><code>$('#tb-user-name').val(); // Should return the value of the input not the "container".
$('#tb-user-name').focus(); // Should focus on the input, not the "container"
</code></pre>

<p>But my code is not working, how can I do this? I have tried "on" but that doesnt work either, does work on focus with a little work around but "val" is not an event but a function.</p>

<p><em><strong>UPDATE (Working but hacky)</em></strong></p>

<p><a href="http://jsfiddle.net/tppiotrowski/WSdmL/3/" rel="nofollow">http://jsfiddle.net/tppiotrowski/WSdmL/3/</a></p>

<p>Thanks for @teddybeard for this solution, this is however not the best way because this is kinda hacky, and since on EVERY key event the val event gets triggered, I am looking for an alternative, if anyone can help me with that that would be awesome.</p>
