How to improve this jQuery toggle method
<p>I'm trying to learn jquery, I've some basics of javascript.</p>

<p>I've written this piece of code to toggle between 3 functions, it works fine</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
    &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;style type="text/css"&gt;
    .format1{
        background: red;
    }
    .format2{
        background: yellow;
    }
    .format3{
        background: blue;
    }
&lt;/style&gt;

&lt;div id="div-toggle"&gt;Click here to toggle&lt;/div&gt;

&lt;script language="javascript"&gt;
    var click = 0;
    $('#div-toggle').toggle(
        function(){
            var el = $('#div-toggle');
            el.addClass('format1');

            el.html('No. of clicks: ' + click++);
        },
        function(){
            var el = $('#div-toggle');
            el.removeClass('format1');
            el.addClass('format2');

            el.html('No. of clicks: ' + click++);
        },
        function(){
            var el = $('#div-toggle');
            el.removeClass('format2');
            el.addClass('format3');

            el.html('No. of clicks: ' + click++);
        }
    );
&lt;/script&gt;
&lt;/html&gt;
</code></pre>

<p>Here if you see the contents of all the functions in the toggle is similar. How can I improve this by moving these code to use a single function?</p>
