jQuery How To Add a Variable
<p>I am a novice in jQuery. I am using some open source code which portions appear below. All I want to do with the code is add a variable ('testVar') that a subsequent function call can handle. Can someone correct my code because the variable definition and handler does not work. Everything works except the testVar variable.</p>

<pre><code>$('#default').countdown({
    until: new Date(2011, 6, 15, 12, 30, 0),
    testVar: 'Testing',
    onTick: displayVariable
});

function displayVariable() {
    $(this).text(testVar);
}
</code></pre>

<p>Thank you.</p>

<p><strong>EDIT:</strong> @Pixeltweak...per your request. The code is below. I simply want to create a text phase that I display on my web page. I need to create a var to do that with.</p>

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

    // override regional defaults
    $.countdown.setDefaults({
        labels: ['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds'],
        labels1: ['year', 'month', 'week', 'day', 'hour', 'minute', 'second']
    });

    // Round #1 Start Times -- note each Date() must match the 'lockout' column in _playoff_bracket:matches 
    $('#defaultCountdown_01').countdown({
        until: new Date(2011, 4 - 1, 13, 19, 30, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_02').countdown({
        until: new Date(2011, 4 - 1, 14, 19, 30, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_03').countdown({
        until: new Date(2011, 4 - 1, 14, 19, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_04').countdown({
        until: new Date(2011, 4 - 1, 13, 19, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_05').countdown({
        until: new Date(2011, 4 - 1, 13, 22, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_06').countdown({
        until: new Date(2011, 4 - 1, 14, 22, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_07').countdown({
        until: new Date(2011, 4 - 1, 13, 19, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_08').countdown({
        until: new Date(2011, 4 - 1, 13, 22, 30, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });

    // Round #2 Start Times -- note each Date() must match the 'lockout' column in _playoff_bracket:matches 
    $('#defaultCountdown_09').countdown({
        until: new Date(2011, 4 - 1, 29, 19, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_10').countdown({
        until: new Date(2011, 4 - 1, 30, 15, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_11').countdown({
        until: new Date(2011, 4 - 1, 28, 21, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_12').countdown({
        until: new Date(2011, 4 - 1, 29, 22, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });

    // Round #3 Start Times -- note each Date() must match the 'lockout' column in _playoff_bracket:matches 
    $('#defaultCountdown_13').countdown({
        until: new Date(2011, 5 - 1, 14, 20, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });
    $('#defaultCountdown_14').countdown({
        until: new Date(2011, 5 - 1, 15, 20, 0, 0),
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });

    // Round #4 Start Times -- note each Date() must match the 'lockout' column in _playoff_bracket:matches 
    $('#defaultCountdown_15').countdown({
        until: new Date(2011, 6 - 1, 1, 20, 0, 0),
        test: 'Testing',
        serverSync: serverTime,
        significant: 2,
        layout: 'This Pick Closes in: {d&lt;}{dn} {dl} {d&gt;}{h&lt;}{hn} {hl} {h&gt;}{m&lt;}{mn} {ml} {m&gt;}{s&lt;}{sn} {sl} {s&gt;}',
        expiryUrl: '/nhl/playoffs/myAccount.html',
        onTick: additionalFormatting
    });

    // additional hightlighting for more than 1-day and within last-hour of pick
    function additionalFormatting(periods) {
        if ($.countdown.periodsToSeconds(periods) &gt;= 86400) {
            $(this).text('You have until Wednesday at 8:00pm ET to finalize this pick');
            //$(this).text($(this).countdown.test);
            $(this).removeClass('hideIt');
            //$(this).addClass('hideIt'); // greater than or equal to 1-day (2011-05-28 changed this method for one above)
        }
        else $(this).removeClass('hideIt'); // less than 24 hours
        if ($.countdown.periodsToSeconds(periods) &lt; 60) { // less than 1-minute
            $(this).addClass('highlightBold'); // change font-weight to bold
            //$(this).countdown('change', 'significant', 1); // eliminate minutes block -- does not work as I hoped for
            //$(this).countdown('change', 'layout', 'This Pick Closes in: {sn} {sl}'); // eliminate minutes block -- does not work either
        }
        else if ($.countdown.periodsToSeconds(periods) &lt; 3600) $(this).addClass('highlight'); // less than 1-hour
    }

});
</code></pre>
