Search code examples
javascriptjquerysymfonybootstrap-datepicker

How to override javascript library function?


I am using Bootstrap datepicker library inside my Symfony application. I would like to overwrite the function updateNavArrows inside bootstrap-datepicker.js by removing/commenting line 1132 and 1142so the prev cursor which currently disappears(when I am on the page with the startDate as today) will always be present. Is there a better way of achieving this without having to modify the original source code?

P.S: I tried to implement the changes using this answer but it doesn't seem to work.


Solution

  • as you can see in the source code here they just remove or add a disabled class to the next and prev buttons

    this.picker.find('.prev').toggleClass('disabled', prevState);
    this.picker.find('.next').toggleClass('disabled', nextState);
    

    this disabled class just puts the visibility of the button to hidden as you can see here

    .prev, .next {
        &.disabled {
            visibility: hidden;
        }
    }
    

    so overriding the css style to set visibility:visible should work