I have some questions about jquery and javascript. I have a code that is not working because of jquery conflict, I believe its because of version, decompressed or compressed (I'm not clear). The part of my code with the jquery is as below:

<head>
<meta name="server-time" content="04/08/2014 09:57:32">
<link rel="stylesheet" href="css/container.css">    
<link rel="stylesheet" href="css/css_main_az.css">  
<link rel="stylesheet" href="css/tabs.css"> 
<link rel="stylesheet" href="css/main.css" type="text/css" />
<link rel="stylesheet" href="css/modal.css">
<link rel="stylesheet" href="css/style.css" type="text/css" id="" media="print, projection, screen" />
<link rel="stylesheet" type="text/css" href="widgets-min.css" title="default"/>
<link rel="stylesheet" type="text/css" href="tipped.css"/>

<script src="css/modal.js"></script>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="widgets-min.js"></script>
<script type="text/javascript" src="spinners.min.js"></script>
<script type="text/javascript" src="tipped.js"></script>
<script type="text/javascript" src="css/jquery.js"></script>
<script src="css/modernizr.custom.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="animatedcollapse.js"></script>
<script type="text/javascript" src="css/jquery-latest.js"></script> 
<script type="text/javascript" src="css/jquery.tablesorter.js"></script>
</head>

Can you guys help me pinpoint the conflicting jquery, and also do i need to include all of those other javascript if I already loaded in from the jquery? for example do i need to reference the animatedcollapse.js if it's already in the jquery library? Lastly what do I need to do to fix this conflicting code?

Thanks in advance

有帮助吗?

解决方案

You are including the jquery library multiple times. The following are redundant, choose one, and remove the rest. You probably want the jquery script to be the first one after your css <link>s

<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="css/jquery.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="css/jquery-latest.js"></script> 

Probably not a bad idea to grab the most recent version from jquery.com and use that. Currently there are 2 choices (1.11.0 and 2.1.0) I'd suggest 1.11.0 unless you are ok disregarding older versions of internet explorer

其他提示

You are loading 4 version of jQuery, you should call only one

<script src="css/modal.js"></script>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="widgets-min.js"></script>
<script type="text/javascript" src="spinners.min.js"></script>
<script type="text/javascript" src="tipped.js"></script>
<script src="css/modernizr.custom.js"></script>
<script type="text/javascript" src="animatedcollapse.js"></script>
<script type="text/javascript" src="css/jquery.tablesorter.js"></script>`
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top