Magento – TypeError: element.prop is not a function – Magento 2

javascriptjquerymagento2magento2.0.8

In product detail page I got below error in browser console at app/code/Magento/PageCache/view/frontend/web/js/page-cache.js

TypeError: element.prop is not a function

.prop('href', element.prop('src'))

here I found one fix, but after that one new error appear that is

Error: Permission denied to access property "document" in http://domainname/pub/static/frontend/Vendor/theme/en_US/jquery.js

note: In luma theme product detail page works fine without any fix in page-cache.js

can anyone have an idea about root cause of the problem?

Best Answer

As the other answers are making changes to vendor and pub/static files:

Copy this file into your theme:

/vendor/magento/module-page-cache/view/frontend/web/js/page-cache.js

And change

.prop('href', element.prop('src'))

To

.prop('href', $(element).prop('src'))

You may need to clear browser and Magento cache. And possibly deploy static content depending on your workflow.