Home >Web Front-end >JS Tutorial >jQuery repeated loading error and how to fix it_jquery
When I was working on a project recently, I encountered a problem:
The parent page imports the child page, the child page imports the jQuery.js file, and the parent page JS depends on jQuery.js. The problem is that it always prompts that the JS object is invalid. I guess the jQuery loading order is not the earliest.
Parent page:
Subpage:
From here, jQuery.js is the earliest, but why do other js prompts that the attributes are invalid.
Later, I used the F12 tool of IE11 to check the loading order of JS and found that jQuery was loaded first. However, after the page was loaded, there was a sudden request to load jQuery again.
The reason is the following code:
jQuery.js is loaded again in xxx.jsp. After commenting this sentence, it will be normal.
This issue has been frustrating me for a long time. I will record it for the convenience of others.
After finding the method, the solution is very simple. The main purpose here is to share with you the ideas for querying the problem. At the same time, friends who have the same problem can refer to it.