Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5955813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:10:01+00:00 2026-05-22T18:10:01+00:00

I am a novice in jQuery. I am using some open source code which

  • 0

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.

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

function displayVariable() {
    $(this).text(testVar);
}

Thank you.

EDIT: @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.

$(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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl} {s>}',
        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) >= 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) < 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) < 3600) $(this).addClass('highlight'); // less than 1-hour
    }

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:10:02+00:00Added an answer on May 22, 2026 at 6:10 pm

    How about:

    $('#default').countdown({
        until: new Date(2011, 6, 15, 12, 30, 0),
        onTick: displayVariable
    }).data("testVar","Testing");
    
    function displayVariable() {
        $(this).text($(this).data("testVar"));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using JQuery, is there a more efficient way of writing this code? See below
I am a AS3 novice learning PureMVC and want to write code following best
So I'm using jQuery to POST some items and save into the database. I
I have noticed some unexpected behaviour when using the jQuery .ready() function, whereby afterwards
I'm doing a search using CI and Jquery, well i'm very novice to this,
I am a novice programmer who is trying to teach myself to code, specifically
I am novice in sharepoint programming. I have a following code: SPWorkflowTask task =
I am a novice in the world of source/version control and I have been
I've got a checkout page which has some ajax calls that update hidden fields
Here's some example code: <input type=checkbox id=send-notice name=send-notice value=1 /> This is a notice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.