aami aami - 1 year ago 58
jQuery Question

Jquery Function works on Local Server but not on Live?

I am stuck with a little problem that i have drop down horizontal menu bar and i have applied jquery functions to open and close Parent and child items.
So fat its works fine on my local server but it is not working on my live server.Every thing is uploaded on live and I have checked my references of all script files many times from live server.

here is my HTML
References :

<script src="../../resources/scripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>

<script src="../../resources/scripts/smooth.js" type="text/javascript"></script>

HTML Code :

<div id="menu">
<ul id="Ul2" class="opened">
<li class="collapsible"><a href="#" class="collapsible plus">Settings</a>
<ul id="Ul3" class="collapsed">
<li><a href="#">General Settings</a></li>
<ul id="Ul4" class="opened">
<li class="collapsible"><a href="#" class="collapsible plus">Email Templates</a>
<ul id="Ul5" class="collapsed">
<li><a href="#">All Email Templates</a></li>
<li><a href="#">Add Email Template</a></li>
<ul id="Ul6" class="opened">
<li class="collapsible"><a href="#" class="collapsible plus">City</a>
<ul id="Ul7" class="collapsed">
<li><a href="#">All Cities</a></li>
<li><a href="#">Add City</a></li>

here is my Script :

$("#menu li a[class~=collapsible]").click(function () {
var element = $(this);

if (element.attr("class") == "collapsible plus") {
element.attr("class", "collapsible minus");
} else {
element.attr("class", "collapsible plus");

var list = element.next();

if (list.attr("class") == "collapsed") {
list.attr("class", "expanded");
} else {
list.attr("class", "collapsed");

Click here to see my site on live so you can easily check problem why script is not calling on live.

Answer Source

I recomend you to do not to use relative path like:


just use browser-reachable Url like:


or just put your assets inside webroot. It's not useful to put your assets(css, js, img) outside webroot, If you want to display them to everyone, then each asset must be reachable by everyone too;