1
0
-1

Hey everyone,

I have created a custom calendar that will display dates on the click of the custom button! The code is running properly outside joget . But in joget ones I click on the button, it reloads the page can u shape me out with the issue?


This is what it displays and very soon it reloads the page and come back to the previous one.

I am also sharing the code so that it can help u to understand. Hope I have convened you all my query properly

 $('#getBetween').click(function () {
                var start = $("#date_picker1").datepicker("getDate"),
                    end = $("#date_picker2").datepicker("getDate"),
                    currentDate = new Date(start),
                    between = []
                    ;

                while (currentDate <= end) {
                    between.push(new Date(currentDate));
                    currentDate.setDate(currentDate.getDate() + 1);
                }

                $(document).ready(function () {
                    $("#results").html(between.map(function (value) {
                        return $('#results:last').after('<div class="block">' + value + '<button class="remove">x</button></div>')
                    }));
                    $('.remove').click(function () {
                        $(this).parent().remove();
                        console.log(between)
                    })
                });


            });


    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Try to add onclick="return false;" as button attribute or perhaps add return false after 

      $(this).parent().remove();
        CommentAdd your comment...