How to show tooltip on disabled dates of jquery datepicker Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How do you disable browser Autocomplete on web form field / input tag?How do I check if an element is hidden in jQuery?How do I format a Microsoft JSON date?How can I know which radio button is selected via jQuery?How to check whether a checkbox is checked in jQuery?How can I select an element with multiple classes in jQuery?Disable/enable an input with jQuery?How do I get the current date in JavaScript?How to disable resizable property of textarea?How can I refresh a page with jQuery?

Co-worker works way more than he should

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

TV series episode where humans nuke aliens before decrypting their message that states they come in peace

Processing ADC conversion result: DMA vs Processor Registers

Simulate round-robin tournament draw

How do I deal with an erroneously large refund?

What to do with someone that cheated their way though university and a PhD program?

Are there existing rules/lore for MTG planeswalkers?

Why do people think Winterfell crypts is the safest place for women, children & old people?

Was there ever a LEGO store in Miami International Airport?

When does Bran Stark remember Jamie pushing him?

SQL Server placement of master database files vs resource database files

Does Prince Arnaud cause someone holding the Princess to lose?

Has a Nobel Peace laureate ever been accused of war crimes?

In search of the origins of term censor, I hit a dead end stuck with the greek term, to censor, λογοκρίνω

Preserving file and folder permissions with rsync

My admission is revoked after accepting the admission offer

"Working on a knee"

false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'

Is it appropriate to mention a relatable company blog post when you're asked about the company?

What's parked in Mil Moscow helicopter plant?

How to keep bees out of canned beverages?

What is the purpose of the side handle on a hand ("eggbeater") drill?

Arriving in Atlanta (after US Preclearance in Dublin). Will I go through TSA security in Atlanta to transfer to a connecting flight?



How to show tooltip on disabled dates of jquery datepicker



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How do you disable browser Autocomplete on web form field / input tag?How do I check if an element is hidden in jQuery?How do I format a Microsoft JSON date?How can I know which radio button is selected via jQuery?How to check whether a checkbox is checked in jQuery?How can I select an element with multiple classes in jQuery?Disable/enable an input with jQuery?How do I get the current date in JavaScript?How to disable resizable property of textarea?How can I refresh a page with jQuery?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















I am trying to add tooltip on some disabled dates as holiday reason but unable get them displayed when hovered. i have even tried adding custom hover function but no success.



availableDates = ["09/04/2018", "09/05/2018", "09/06/2018", "08/31/2018", "09/01/2018"];
holidays_dates = "09/02/2018": "sgsdf", "05/27/2018": "home sick", "08/20/2018": "fcg", "05/26/2018": "i dont know", "05/25/2018": "home sick"

function available(date)

var moth = String(date.getMonth() + 1);
if (moth.length == 1)
moth = "0" + moth;


var dat = String(date.getDate());
if (dat.length == 1)
dat = "0" + dat;

dmy = moth + "/" + dat + "/" + date.getFullYear();

if ($.inArray(dmy, availableDates) != -1)
return [true, ""];
else if (dmy in holidays_dates)
console.log(dmy)
return [false, "Highlighted", holidays_dates[dmy]];
else
return [false, ""];




$("#datepicker").datepicker(
beforeShowDay: function (dt)
return available(dt);
,
changeMonth: true,
changeYear: true,
onSelect: function (dateText)
getslots(dateText, selected_consultant);

);


the holidays_dates variable consists of disabled date and reason and is perfectly adding the reason to the title of the element



<td class=" ui-datepicker-unselectable ui-state-disabled Highlighted" title="home sick">
<span class="ui-state-default">25</span>
</td>


as above holiday reason added in title attribute of tag but hovering on that date does not show tooltip










share|improve this question






























    2















    I am trying to add tooltip on some disabled dates as holiday reason but unable get them displayed when hovered. i have even tried adding custom hover function but no success.



    availableDates = ["09/04/2018", "09/05/2018", "09/06/2018", "08/31/2018", "09/01/2018"];
    holidays_dates = "09/02/2018": "sgsdf", "05/27/2018": "home sick", "08/20/2018": "fcg", "05/26/2018": "i dont know", "05/25/2018": "home sick"

    function available(date)

    var moth = String(date.getMonth() + 1);
    if (moth.length == 1)
    moth = "0" + moth;


    var dat = String(date.getDate());
    if (dat.length == 1)
    dat = "0" + dat;

    dmy = moth + "/" + dat + "/" + date.getFullYear();

    if ($.inArray(dmy, availableDates) != -1)
    return [true, ""];
    else if (dmy in holidays_dates)
    console.log(dmy)
    return [false, "Highlighted", holidays_dates[dmy]];
    else
    return [false, ""];




    $("#datepicker").datepicker(
    beforeShowDay: function (dt)
    return available(dt);
    ,
    changeMonth: true,
    changeYear: true,
    onSelect: function (dateText)
    getslots(dateText, selected_consultant);

    );


    the holidays_dates variable consists of disabled date and reason and is perfectly adding the reason to the title of the element



    <td class=" ui-datepicker-unselectable ui-state-disabled Highlighted" title="home sick">
    <span class="ui-state-default">25</span>
    </td>


    as above holiday reason added in title attribute of tag but hovering on that date does not show tooltip










    share|improve this question


























      2












      2








      2


      1






      I am trying to add tooltip on some disabled dates as holiday reason but unable get them displayed when hovered. i have even tried adding custom hover function but no success.



      availableDates = ["09/04/2018", "09/05/2018", "09/06/2018", "08/31/2018", "09/01/2018"];
      holidays_dates = "09/02/2018": "sgsdf", "05/27/2018": "home sick", "08/20/2018": "fcg", "05/26/2018": "i dont know", "05/25/2018": "home sick"

      function available(date)

      var moth = String(date.getMonth() + 1);
      if (moth.length == 1)
      moth = "0" + moth;


      var dat = String(date.getDate());
      if (dat.length == 1)
      dat = "0" + dat;

      dmy = moth + "/" + dat + "/" + date.getFullYear();

      if ($.inArray(dmy, availableDates) != -1)
      return [true, ""];
      else if (dmy in holidays_dates)
      console.log(dmy)
      return [false, "Highlighted", holidays_dates[dmy]];
      else
      return [false, ""];




      $("#datepicker").datepicker(
      beforeShowDay: function (dt)
      return available(dt);
      ,
      changeMonth: true,
      changeYear: true,
      onSelect: function (dateText)
      getslots(dateText, selected_consultant);

      );


      the holidays_dates variable consists of disabled date and reason and is perfectly adding the reason to the title of the element



      <td class=" ui-datepicker-unselectable ui-state-disabled Highlighted" title="home sick">
      <span class="ui-state-default">25</span>
      </td>


      as above holiday reason added in title attribute of tag but hovering on that date does not show tooltip










      share|improve this question
















      I am trying to add tooltip on some disabled dates as holiday reason but unable get them displayed when hovered. i have even tried adding custom hover function but no success.



      availableDates = ["09/04/2018", "09/05/2018", "09/06/2018", "08/31/2018", "09/01/2018"];
      holidays_dates = "09/02/2018": "sgsdf", "05/27/2018": "home sick", "08/20/2018": "fcg", "05/26/2018": "i dont know", "05/25/2018": "home sick"

      function available(date)

      var moth = String(date.getMonth() + 1);
      if (moth.length == 1)
      moth = "0" + moth;


      var dat = String(date.getDate());
      if (dat.length == 1)
      dat = "0" + dat;

      dmy = moth + "/" + dat + "/" + date.getFullYear();

      if ($.inArray(dmy, availableDates) != -1)
      return [true, ""];
      else if (dmy in holidays_dates)
      console.log(dmy)
      return [false, "Highlighted", holidays_dates[dmy]];
      else
      return [false, ""];




      $("#datepicker").datepicker(
      beforeShowDay: function (dt)
      return available(dt);
      ,
      changeMonth: true,
      changeYear: true,
      onSelect: function (dateText)
      getslots(dateText, selected_consultant);

      );


      the holidays_dates variable consists of disabled date and reason and is perfectly adding the reason to the title of the element



      <td class=" ui-datepicker-unselectable ui-state-disabled Highlighted" title="home sick">
      <span class="ui-state-default">25</span>
      </td>


      as above holiday reason added in title attribute of tag but hovering on that date does not show tooltip







      javascript jquery html jquerydatetimepicker






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 13 '18 at 14:37









      vronjec

      255113




      255113










      asked Jun 13 '18 at 14:07









      Pavan Kumar T SPavan Kumar T S

      647619




      647619






















          1 Answer
          1






          active

          oldest

          votes


















          2














          To disable the date and show tooltip use option beforeShowDay.



          beforeShowDay: function (date) 
          var formattedDate = $.datepicker.formatDate('mm/dd/yy', date),
          checkDisable = disabledDates.indexOf(formattedDate) == -1;

          if(checkDisable == true)
          return [checkDisable];
          else
          //add ui-datepicker-unselectable class to the disabled date.
          return [!checkDisable,'ui-datepicker-unselectable',holidays_dates[formattedDate]];




          and customize the css of the disabled date



          function changeDisableDateColor()
          var unselectableDate = $('.ui-datepicker-unselectable a');

          unselectableDate.css(
          background: 'red',
          cursor: 'context-menu',
          border: 0
          );




          call the above function i.e changeDisableDateColor when date field is clicked.
          $('#datepicker').click(function()
          changeDisableDateColor();
          );



          and also inside onChangeMonthYear (detects the change in month or year) option



          onChangeMonthYear: function()
          setTimeout(function()
          changeDisableDateColor();
          );



          setTimeout is used because the jquery ui removes all the dates item and add again, so we wait until we have right date. Without setTimeout var unselectableDate = $('.ui-datepicker-unselectable a'); will give previous date.



          Here is the jsfiddle: http://jsfiddle.net/Xx4GS/1225/



          Hope I answered the question.



          Edited:



          There was bug, when day or month is of single digit ie 1-9 then the date does not get matched and will not be disabled.



          if(month.toString().length == 1)
          month = '0'+month.toString();


          if(day.toString().length == 1)
          day = '0'+ day.toString();



          Fixed the bug by adding 0 in front of day and month.



          Here is the solved js fiddle: http://jsfiddle.net/Lf5p3hct/2/






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50839300%2fhow-to-show-tooltip-on-disabled-dates-of-jquery-datepicker%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            To disable the date and show tooltip use option beforeShowDay.



            beforeShowDay: function (date) 
            var formattedDate = $.datepicker.formatDate('mm/dd/yy', date),
            checkDisable = disabledDates.indexOf(formattedDate) == -1;

            if(checkDisable == true)
            return [checkDisable];
            else
            //add ui-datepicker-unselectable class to the disabled date.
            return [!checkDisable,'ui-datepicker-unselectable',holidays_dates[formattedDate]];




            and customize the css of the disabled date



            function changeDisableDateColor()
            var unselectableDate = $('.ui-datepicker-unselectable a');

            unselectableDate.css(
            background: 'red',
            cursor: 'context-menu',
            border: 0
            );




            call the above function i.e changeDisableDateColor when date field is clicked.
            $('#datepicker').click(function()
            changeDisableDateColor();
            );



            and also inside onChangeMonthYear (detects the change in month or year) option



            onChangeMonthYear: function()
            setTimeout(function()
            changeDisableDateColor();
            );



            setTimeout is used because the jquery ui removes all the dates item and add again, so we wait until we have right date. Without setTimeout var unselectableDate = $('.ui-datepicker-unselectable a'); will give previous date.



            Here is the jsfiddle: http://jsfiddle.net/Xx4GS/1225/



            Hope I answered the question.



            Edited:



            There was bug, when day or month is of single digit ie 1-9 then the date does not get matched and will not be disabled.



            if(month.toString().length == 1)
            month = '0'+month.toString();


            if(day.toString().length == 1)
            day = '0'+ day.toString();



            Fixed the bug by adding 0 in front of day and month.



            Here is the solved js fiddle: http://jsfiddle.net/Lf5p3hct/2/






            share|improve this answer





























              2














              To disable the date and show tooltip use option beforeShowDay.



              beforeShowDay: function (date) 
              var formattedDate = $.datepicker.formatDate('mm/dd/yy', date),
              checkDisable = disabledDates.indexOf(formattedDate) == -1;

              if(checkDisable == true)
              return [checkDisable];
              else
              //add ui-datepicker-unselectable class to the disabled date.
              return [!checkDisable,'ui-datepicker-unselectable',holidays_dates[formattedDate]];




              and customize the css of the disabled date



              function changeDisableDateColor()
              var unselectableDate = $('.ui-datepicker-unselectable a');

              unselectableDate.css(
              background: 'red',
              cursor: 'context-menu',
              border: 0
              );




              call the above function i.e changeDisableDateColor when date field is clicked.
              $('#datepicker').click(function()
              changeDisableDateColor();
              );



              and also inside onChangeMonthYear (detects the change in month or year) option



              onChangeMonthYear: function()
              setTimeout(function()
              changeDisableDateColor();
              );



              setTimeout is used because the jquery ui removes all the dates item and add again, so we wait until we have right date. Without setTimeout var unselectableDate = $('.ui-datepicker-unselectable a'); will give previous date.



              Here is the jsfiddle: http://jsfiddle.net/Xx4GS/1225/



              Hope I answered the question.



              Edited:



              There was bug, when day or month is of single digit ie 1-9 then the date does not get matched and will not be disabled.



              if(month.toString().length == 1)
              month = '0'+month.toString();


              if(day.toString().length == 1)
              day = '0'+ day.toString();



              Fixed the bug by adding 0 in front of day and month.



              Here is the solved js fiddle: http://jsfiddle.net/Lf5p3hct/2/






              share|improve this answer



























                2












                2








                2







                To disable the date and show tooltip use option beforeShowDay.



                beforeShowDay: function (date) 
                var formattedDate = $.datepicker.formatDate('mm/dd/yy', date),
                checkDisable = disabledDates.indexOf(formattedDate) == -1;

                if(checkDisable == true)
                return [checkDisable];
                else
                //add ui-datepicker-unselectable class to the disabled date.
                return [!checkDisable,'ui-datepicker-unselectable',holidays_dates[formattedDate]];




                and customize the css of the disabled date



                function changeDisableDateColor()
                var unselectableDate = $('.ui-datepicker-unselectable a');

                unselectableDate.css(
                background: 'red',
                cursor: 'context-menu',
                border: 0
                );




                call the above function i.e changeDisableDateColor when date field is clicked.
                $('#datepicker').click(function()
                changeDisableDateColor();
                );



                and also inside onChangeMonthYear (detects the change in month or year) option



                onChangeMonthYear: function()
                setTimeout(function()
                changeDisableDateColor();
                );



                setTimeout is used because the jquery ui removes all the dates item and add again, so we wait until we have right date. Without setTimeout var unselectableDate = $('.ui-datepicker-unselectable a'); will give previous date.



                Here is the jsfiddle: http://jsfiddle.net/Xx4GS/1225/



                Hope I answered the question.



                Edited:



                There was bug, when day or month is of single digit ie 1-9 then the date does not get matched and will not be disabled.



                if(month.toString().length == 1)
                month = '0'+month.toString();


                if(day.toString().length == 1)
                day = '0'+ day.toString();



                Fixed the bug by adding 0 in front of day and month.



                Here is the solved js fiddle: http://jsfiddle.net/Lf5p3hct/2/






                share|improve this answer















                To disable the date and show tooltip use option beforeShowDay.



                beforeShowDay: function (date) 
                var formattedDate = $.datepicker.formatDate('mm/dd/yy', date),
                checkDisable = disabledDates.indexOf(formattedDate) == -1;

                if(checkDisable == true)
                return [checkDisable];
                else
                //add ui-datepicker-unselectable class to the disabled date.
                return [!checkDisable,'ui-datepicker-unselectable',holidays_dates[formattedDate]];




                and customize the css of the disabled date



                function changeDisableDateColor()
                var unselectableDate = $('.ui-datepicker-unselectable a');

                unselectableDate.css(
                background: 'red',
                cursor: 'context-menu',
                border: 0
                );




                call the above function i.e changeDisableDateColor when date field is clicked.
                $('#datepicker').click(function()
                changeDisableDateColor();
                );



                and also inside onChangeMonthYear (detects the change in month or year) option



                onChangeMonthYear: function()
                setTimeout(function()
                changeDisableDateColor();
                );



                setTimeout is used because the jquery ui removes all the dates item and add again, so we wait until we have right date. Without setTimeout var unselectableDate = $('.ui-datepicker-unselectable a'); will give previous date.



                Here is the jsfiddle: http://jsfiddle.net/Xx4GS/1225/



                Hope I answered the question.



                Edited:



                There was bug, when day or month is of single digit ie 1-9 then the date does not get matched and will not be disabled.



                if(month.toString().length == 1)
                month = '0'+month.toString();


                if(day.toString().length == 1)
                day = '0'+ day.toString();



                Fixed the bug by adding 0 in front of day and month.



                Here is the solved js fiddle: http://jsfiddle.net/Lf5p3hct/2/







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 22 at 14:54

























                answered Oct 11 '18 at 17:09









                RojenRojen

                10915




                10915





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50839300%2fhow-to-show-tooltip-on-disabled-dates-of-jquery-datepicker%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript