1

So we had some code like so

    function handleDayClick(date)
    {
        if (date.local() < startDate || date.local() >= endDate) {
            $("#dayClickMsg").show();
            return;
        }
        $('#dayClickMsg').hide();
        //do other stuff
    }

and some HTML:

    <div id="dayClickMsg" hidden style="color:seagreen; float:right">
        Clicked day not in range.
    </div>

But after the upgrade, the function doesn't seem to be working. Setting a breakpoint on .show() tells me the element is being fetched properly, but the .show() method call isn't working. Similarily, .hide() is also not working.

Edit, console errors:

sign-error-icon.png:1 Failed to load resource: the server responded with a status of 404 ()
help-icon.png:1 Failed to load resource: the server responded with a status of 404 ()
popper:37 Uncaught SyntaxError: Unexpected token export
sign-error-icon.png:1 Failed to load resource: the server responded with a status of 404 ()
help-icon.png:1 Failed to load resource: the server responded with a status of 404 ()

Edit: Possibly related to https://jquery.com/upgrade-guide/3.0/#breaking-change-show-hide-and-toggle-methods-now-respect-more-stylesheet-changes

Scuba Steve
  • 1,541
  • 1
  • 19
  • 47
  • Any console errors we should know about? – Jon P Feb 20 '19 at 23:07
  • one observation is according to your limited example, you don't pass startDate nor endDate, they are no where to found but are used in your function – imvain2 Feb 20 '19 at 23:07
  • imvain - this code is part of a massive calendar module, the dates are getting passed properly, and the .show() line is being reached as expected. I figured I'd spare you guys the details. – Scuba Steve Feb 20 '19 at 23:08
  • @JonP - my icons aren't loading for some reason, which is fine, as I've got a new icon set to use, and there's that popper problem – Scuba Steve Feb 20 '19 at 23:10
  • I know it is a HTML5 attribute, but have you tried testing it without the hidden attribute in the div? – imvain2 Feb 20 '19 at 23:17
  • @imvain2 - Yes. I removed hidden, and the .show() .hide() still wasn't working. That's how I tested whether hide() was working. – Scuba Steve Feb 20 '19 at 23:21
  • With regard to you syntax error, this [this](https://stackoverflow.com/questions/38296667/getting-unexpected-token-export) of any relevance? – Jon P Feb 20 '19 at 23:32
  • @JonP - I did notice that a week ago or so. I'm using asp.net MVC, and I'm unsure how to use BundleConfig.cs to package the js libray as a module. – Scuba Steve Feb 20 '19 at 23:41

1 Answers1

2

try to use property in instead

function handleDayClick(date)
    {
        if (date.local() < startDate || date.local() >= endDate) {
            $("#dayClickMsg").prop('hidden', false);

            return;
        }
        $('#dayClickMsg').prop('hidden', true);

        //do other stuff
    }