$.cookie is not a function typeerror

前端 未结 4 470
甜味超标
甜味超标 2020-12-20 12:14

What does this error mean and how do I fix it?

TypeError: $.cookie is not a function
[Break On This Error]   

$($.cookie(\"inputFocus\")).focus()

相关标签:
4条回答
  • 2020-12-20 12:46

    It means the library that's supposed to have that function is not loaded. But you can set a cookie using javascript, here:

    https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie

    0 讨论(0)
  • 2020-12-20 13:00

    You need to include the jQuery cookie plugin before this code snippet.

    0 讨论(0)
  • 2020-12-20 13:02

    That error means exactly what it says: $.cookie does not exist.

    jQuery core does not include anything related to cookies. There are several cookie libraries that add a cookie function to $. You need to add one to your page first.

    0 讨论(0)
  • 2020-12-20 13:13

    Including jquery file twice(multiple time) also gave same issue in my case.

    0 讨论(0)
提交回复
热议问题