onDayClick not working

Issue #35 closed
Former user created an issue

hi! i have last version downloaded. i try onDayClick and onMonthChange callbacks, but nothing happens (alert('ok') never shows). events are set correctly and they are displayed on the calendar. i use latest jquery and bootstrap3. please, help)

Comments (6)

  1. Lukasz Kokoszkiewicz repo owner

    Hi, I was trying this code:

    $(document).ready(function () {
      $(".responsive-calendar").responsiveCalendar({
        time: '2013-05',
        events: {
          "2013-04-30": {"number": 5, "url": "http://w3widgets.com/responsive-slider"},
          "2013-04-26": {"number": 1, "url": "http://w3widgets.com"}, 
          "2013-05-03":{"number": 1}, 
          "2013-06-12": {}
        },
        onDayClick: function() {
          alert('hey!');
        },
        onMonthChange: function() {
          alert('yo!');
        }
      });
    });
    

    and everything seems to work fine.

  2. Konstantin Pekov

    thank you for reply! i can explain: if i set onDayClick event handler inside init JS (as you show below), everything seems to be OK, but if i set it outside (after init) like this:

    $(".responsive-calendar").responsiveCalendar({
    onDayClick: function() {
          alert('hey!');
        }
    });
    

    its not working. could you test it, please?

    i think i just use wrong syntax to set event handler. sorry))) could you tell me how to do it right (outside init JS)? thank you

  3. Lukasz Kokoszkiewicz repo owner

    Yup, that's normal. Callbacks are defined only on initialization and will not work when defining after init.

  4. Log in to comment