开发者

one page and two <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>

开发者 https://www.devze.com 2023-02-04 19:46 出处:网络
sorry for bad english. i have the page (index.html) with a line <script type=\"tex开发者_StackOverflow中文版t/javascript\" src=\"/js/jquery-1.4.2.min.js\"></script>.

sorry for bad english. i have the page (index.html) with a line

 <script type="tex开发者_StackOverflow中文版t/javascript" src="/js/jquery-1.4.2.min.js"></script>.

this page loads ajax page (page2.html). this ajax page include <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script> itself. when page2.html load in main page (index.html) there is no problem with page2.html performance but another function with jquery in index.html got error like this "object dosent support this property" although it worked before page2.html load. it seems that there are conflict between two jquery. if i remove <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script> from page2.html it work fine because index.html include this line but page2.html will not work independently. i tried $.noConflict(); and it doesnt work.


Try this first

It looks like you are trying to use two javascript frameworks on the same page. To do this you probably need to run jQuery.noConflict() after you load jquery, then instead of using $() to access jQuery functions, use jQuery().

Refer this link


You can load a fragment of a page so instead of doing

.load('page2.html');

do

.load('page2.html #contentDiv');

So that will just load a portion of the page that excludes the script tags.

0

精彩评论

暂无评论...
验证码 换一张
取 消