locked
How to fix error - Object doesn't support property or method 'andSelf' RRS feed

  • Question

  • User-1308344544 posted

    Recently I updated all my NuGet packages including all jQueries and now I am getting error

    Unhandled exception at line 4055, column 3 in http://localhost:55598/ISIIntranet/Scripts/jquery-3.5.1.js
    0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'andSelf' occurred

    this is MVC application - when I look for all occurrences of 'andSelf' VS finds it in 3 files:

    • jquery-3.5.1.intelisense.js
    • jquery.validate.unobtrusive.js
    • jquery.validate.unobtrusive.min.js

    how to fix it?

    Monday, October 26, 2020 8:39 PM

Answers

  • User475983607 posted

    I know it has been removed but why my jquery-3.5.1.intellisense.js has it?  

    It's just intellisense.  There's no implementation in the file.  But I agree there should be some a note about andSelf() being deprecated.

    Did you upgrade jquery.validate.unobtrusive.js to version v3.2.11?  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 26, 2020 9:50 PM

All replies

  • User475983607 posted

    According to jQuery andSelf() has been removed from jQuery 3.  jQuery doc recommend replacing andSelf() with addBack().

    https://api.jquery.com/andself/

    how to fix it?

    Either drop back the jQuery version that has andSelf(), update the jQuery dependent library that uses andSelf(), or update your custom code that uses andSelf().

    Monday, October 26, 2020 9:13 PM
  • User-1308344544 posted

    I know it has been removed but why my jquery-3.5.1.intellisense.js has it?  

    Monday, October 26, 2020 9:18 PM
  • User475983607 posted

    I know it has been removed but why my jquery-3.5.1.intellisense.js has it?  

    It's just intellisense.  There's no implementation in the file.  But I agree there should be some a note about andSelf() being deprecated.

    Did you upgrade jquery.validate.unobtrusive.js to version v3.2.11?  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 26, 2020 9:50 PM
  • User-1308344544 posted

    Yes, and it fixed the issue, thank you

    Tuesday, October 27, 2020 2:13 PM