so I was making a website and moved around the scripts a bit in the page and all of a sudden some of the scrips stopped running on my clients PC. I had to do some hit and try and it finally worked, but I cant figure out what caused the problem.
this is the structure when it wasnt working
<html>
<head>
<script type='text/javascript' src='somepath/script/jquery.js'></script>
<script type='text/javascript'>
//some custom jquery script
</script>
</head>
<body>
....lots of stuff
</body>
</html>
<script type='text/javascript' src="sompath/some_jquery_plugin.js'></script>
<script type='text/javascript'>
//some custom jquery script
</script>
this is the structure when it was working
<html>
<head>
<script type='text/javascript' src='somepath/script/jquery.js'></script>
<script type='text/javascript'>
//some custom jquery script
</script>
</head>
<body>
....lots of stuff
</body>
</html>
<script type='text/javascript' src='somepath/script/jquery.js'></script>
<script type='text/javascript' src="sompath/some_jquery_plugin.js'></script>
<script type='text/javascript'>
//some custom jquery script
</script>
i.e notice the additional jquery.js inclusion at the end….
what possible reasons could have caused this? specially since it was working on my system on all browsers but not my clients.
***update********
I think jquery stopped working somewhere in the middle… i.e I had this script at the end
$('#start').val('0000.00.00 00:00');
$('#end').val('0000.00.00 00:00');
but the fields with “start” and “end” id werent showing the given data. hence the extra inclusion of jquery required.
Does the first inline script use
jQuery.noConflict(or$.noConflict)? Does the “....lots of stuff” in your example load some other library like Prototype that might redefine the$object? This may be the problem.Try putting all of your code in the second script tags inside of:
(and remove the second jQuery inclusion) and see if that helps.
If your code is already wrapped in:
or:
then try changing it to:
or:
(note that it’s
function ($)instead offunction ())(You may also need to put the plugin just below the first jQuery in case it is not written in a way that works with
$undefined or redefined but generally that shouldn’t be necessary for plugins written properly.)