chris Frisina
chris Frisina

Reputation: 19688

JQuery show()/hide() selector for start date range

Here is the fiddle. I am trying to allow the user to select a range (multiple times if they choose) and it show the positions within the time frame. I can not get the start date input range to work more than once, despite it being on change. The start date selector code is this:

//start selector functionality
    $('#startdate').on('change', function () {
        var $formelem = $(this);
        // Hide all positions that end before the specified date.
        $('section.position time.start').each(function () {
            if (compareTime($(this).attr('datetime'), $formelem.val()) <= 0) {
                $(this).parent().hide();
            } else {
                $(this).parent().show();
            }
        });
        $('section.company > time').remove();
        $('section.company').each(processCompanyTime);
    });

Any clues as to why it won't work more than once? the end selector works multiple times.

Upvotes: 0

Views: 309

Answers (1)

Newbo.O
Newbo.O

Reputation: 1948

Your problem is in your processCompanyTime function which has a condition to hide the section.company but not to show it. So when it's hidden, it will never be shown again.

Upvotes: 1

Related Questions