Link to home
Start Free TrialLog in
Avatar of samssAabee
samssAabee

asked on

jQuery doesn't fire at all. Nothing happens!

Hi experts,

I have strange issue with jquery on my coldfusion page.

Issue my jquery doesn't work at all, i mean it doesn't even call a function neither it shows any error. Nothing happends absolutely!!  I do have the jquery library included on the page. I have no idea what happens there and why. I have worked with jquery on other applications thought I am no expert.

Would you help me figure it out...

Thanks,
samssAabee
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

...can you post the code that's not working?  How do you know it's not firing?  Maybe it's firing, but not working the way you expect...
Avatar of samssAabee
samssAabee

ASKER

Well that's what I thought, then I just added a simple function which does nothing but just an alert and called the function. And that's when I thought it's not firing at all.  So here is the code I used for testing.

Also if i use pure javascript like using getElementById('forTest').value() it works fine.

<form>
<input type="text" name="forTest" id="forTest" value="I have some text" onmousemove="testSomething();" />
<input type="button" value="Test Function" onclick="testSomething();" />
</form>


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

<script type="text/javascript">
  function testSomething()
  {      
       var getText  = $('#forTest').val();
       alert(getText);      
  }

</script>
If what you showed above is how the code is written on the page, try putting the function above the HTML that calls it.  In the above scenario, when the button is created, the function doesn't exist.
ASKER CERTIFIED SOLUTION
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, I forgot to change that link. The reference I use is this.

<script src="scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
Nevertheless, that's what's wrong.  

Maybe the tag needs to read...
   <script src="/scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
...or...
   <script src="~/scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
...or something else beyond my ken.  It looks like a path issue.
I tried these...

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

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

and even moved the script to the same directory where my code file is and used this..

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

didn't work.

But havent' tried this...

 <script src="~/scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
Is it possible you have javascript turned off in your browser?  Did the example I posted work for you?  If so, javascript (and therefore jQuery) is fine, but your browser can't find the .js library.
I will verify the javascript settings in my browser. I know javascript works on this same page.
Maybe try a different browser?  

Again, my version of your page worked for me - does it work for you?
I turned on the script debbugger to see what's going on. So now it complains that the object is not defined referring to the .val() function. So obviously it doesn't find my jquery reference.

So like you were suggesting, i tried all the possible paths to this jquery file but it doen't still get it. It's definitely my local problem though it doesn't make sense to me.
I just tried your jquery reference. https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js 

That works!! so I think the jquery file is probably corrupted. I am trying to down load this 1.6.2 version, because I don't want to hard code the absolute URL on my reference.
Great.  Let us know if/when it's working properly.
Sweet! downloaded it from the same site (https://ajax.googleapis.com) and saved it to my scripts folder and referenced it on my code. It works!!!

Good job!! thanks very much! I am back in business!
Happy to help.