Running a custom function - settings.func is not a function
<p>I have written a jQuery plugin which I want to call a custom function on like so...</p>

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

    $.fn.testPlugin= function(options) {

        var settings = {
            func: null
        };

        if (options) {
            $.extend(settings, options);
        }

        settings.func();
    };

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

<p>In this case I want to run the <code>doSomething</code> function.</p>

<pre><code>$(document).ready(function(){       

    $('div').testPlugin({
        func: 'doSomething'
    });

});

function doSomething() {
    alert('hello');
}
</code></pre>

<p>I always get the error <code>settings.func is not a function</code> so I am having to use:</p>

<pre><code>eval(settings.func+"()");
</code></pre>

<p>Intead of:</p>

<pre><code>settings.func();
</code></pre>

<p>Which is not ideal! Any ideas why I am getting this?</p>
