Enable weekends in jQuery Datepicker

In my previous post "Disable Weekends in jQuery DatePicker", I had shown you that how can you disable the weekends in jQuery Datepicker control. However, there could be a situation where you need to enable only weekends and disable all the other days. See below image.


Below given small piece of code fulfill our requirement.
    $('#txtDate1').datepicker({ beforeShowDay:
        return [dt.getDay() == 0 || dt.getDay() == 6, ""];
When you run this code, you will see the only weekends are enabled. beforeShowDay option, which takes a function to be called for each date, returning true if the date is allowed or false if it is not.
See live Demo and Code.
Feel free to contact me for any help related to jQuery. I will gladly help you.

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..