升级到Bootstrap 4,jQuery 3.3.1后,jQuery .show()/.hide()无法正常工作

时间:2019-02-20 23:04:05

标签: jquery bootstrap-4

所以我们有一些像这样的代码

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

和一些HTML:

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

但是升级后,该功能似乎无法正常工作。在.show()上设置断点可以告诉我元素已正确获取,但是.show()方法调用无法正常工作。同样,.hide()也无法正常工作。

编辑,控制台错误:

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 ()

编辑:可能与https://jquery.com/upgrade-guide/3.0/#breaking-change-show-hide-and-toggle-methods-now-respect-more-stylesheet-changes

相关

1 个答案:

答案 0 :(得分:1)

尝试改用属性

    $countries = Country::where('code', '=', $code)
 ->with(array('cities' => function ($query) use ($user) {
    $query->where('name', '=', 'San Francisco')->with('details');
    }))->first();
相关问题