jqueryzurb-foundationzurb-reveal

Click events not firing after Foundation reveal close


I have a page with a button which when clicked opens a reveal modal using jquery and foundation. It looks a little like:

$(".playersScores").unbind('click').bind('click', function () {
    $('#addScore2').foundation('reveal', 'open');
    //Do some stuff
});

In the modal there is a submit button which when clicked closes the reveal like:

$(".submitButton").unbind('click').bind('click', function () {
    // do some stuff
    $('#addScore2').foundation('reveal', 'close');
});

This all works once the modal closes the player scores button no longer works until the page is reloaded - it just stops listening for events.

Can anyone point me in the right direction please?


Solution

  • I had asked this question on the foundation forums:

    http://foundation.zurb.com/forum/posts/17739-click-events-not-firing-after-foundation-reveal-close

    the solution I ended up with was:

    $(document).on('click', ".playersScores", function () {
        $('#addScore2').foundation('reveal', 'open');
        //Do some stuff
    });