• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 508
  • Last Modified:

Javascript/JQuery not working initially...page requires refresh

Using ASP.net I am created a web application which features JQuery and Javascript.  I'm finding that somewhat regularly javascript events associatd to button and text box controls are not running.  If I refresh the page with F5 it will  then work.  What would be causing this and how can I fix it?

I first noticed it on my development station (Visual Studio 2010 with IE 9) but users did not report the problem in production.  I have started getting calls from users on the production  system so am getting worried!
0
canuckconsulting
Asked:
canuckconsulting
1 Solution
 
Chris StanyonCommented:
It's impossible to tell without seeing your site.

Check to make sure the elements with the events are actually loaded when you do the binding by wrapping all of your jQuery stuff inside the $(document).ready function. Without this your script may try to run before the DOM is loaded.
0
 
vinhnlCommented:
Do you see javascript bugs on status bar ? Which javascript events have you used ?

If you have a bug in javascript, maybe ie will block all client events on your site
0
 
Derek JensenCommented:
Yeah, definitely check for errors; I've set up my system to auto-popup page errors in IE, so I *always* see them. Annoying, I know, but considering I use FF most the time...
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
canuckconsultingAuthor Commented:
Frustratingly it doesn't seem to break in firefox.  How can I configure I configure ie to pop up the errors?  This sounds like a useful way to test my site.
0
 
Derek JensenCommented:
Indeed, let me track down how I did that; I remember it was pretty buried, not in your typical configuration locations...you're on Windows 7, right?
0
 
canuckconsultingAuthor Commented:
Yup, w7 with ie9.  Thanks.
0
 
Derek JensenCommented:
Ah! That was easy! It's just in Internet Options->Advanced settings, under Browser. :)Always display errors
0
 
canuckconsultingAuthor Commented:
I'm almost too embarrased to say the issue.  All my pages started with:

$('document').ready

Not

$(document).ready

Tragic.  Thanks for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now