Is there a way to run my own javascript after all JS files have loaded and ASP.NET javascript has finished initialized and loaded. I am currently using jQuery to run javascript after page load and that does not guarantee it will load after ASP.NET javascript. Thanks
-
are you having an issue with something specific? afaik all js added by asp.net runs immediately.lincolnk– lincolnk2010-10-04 20:03:10 +00:00Commented Oct 4, 2010 at 20:03
-
Not all JS added by ASP.net controls, especially third-party ones. Some of them need to wait for the document to finish loading as well.cHao– cHao2010-10-04 20:11:48 +00:00Commented Oct 4, 2010 at 20:11
Add a comment
|
1 Answer
have you looked at the
.ready()
documented here http://api.jquery.com/ready/
it should run once the Dom is ready to use.
PS what do you mean by ASP.NET JavaScript, any JS generated from ASP.NET will be done before the page is returned to the client. the second the page is returned to the user, all the JS should be generated, or linked too (if in an external js file)
EDIT:
did you mean in your JS they run on doc ready, and you would like to run yours after this?
could you not make a script, which calls all the functions in order? like this
2 Comments
cHao
"I am currently using jQuery to run javascript after page load" means
ready() is already in use. The problem is that any number of other scripts could be not-yet run and might need their own ready() handlers -- and ready() sets stuff up to run in the order it was added. It doesn't provide a way to guarantee that a given script will run last.dbones
thanks, I thought I may have got hold of wrong end of the stick.. I normally use a JS function to setup my other JS objects. Other than this my best guess would be to move your code to the last point of the JS registration?