Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 649
  • Last Modified:

How to Run jQuery Code After Other Scripts Are Done

I have a jQuery plugin that I wrote that resizes some Telerik controls. The problem is that Telerik runs some JavaScript after the DOM is ready, and my jQuery runs before Telerik's script.

Is there a way I can ensure that my plugin code will run only after other scripts have fired?
0
hehdaddy
Asked:
hehdaddy
  • 2
1 Solution
 
darren-w-Commented:
place your scripts after the other ones,  or use document ready method detailed here http://docs.jquery.com/Tutorials:Introducing_$%28document%29.ready%28%29
0
 
Gurvinder Pal SinghCommented:
if the Telerik's scripts are plugin, then they will be fired as soon as they are arrived and compiled on browser's client. That is how plug-ins works, they get executed by themselves.

You can setup a flag, or some condition to be checked,  before loading jquery programmatically if you want.
http://ajaxpatterns.org/On-Demand_Javascript
http://ntt.cc/2008/02/10/4-ways-to-dynamically-load-external-javascriptwith-source.html
http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
0
 
hehdaddyAuthor Commented:
Thanks for the great information. I ended up with a temporary hack until I can find a real solution that will be maintainable. I just set a JavaScript timeout for 200ms, which seemed to do the trick. Not ideal, but I moved on.

@gurvinder372 - I am awarding you points for your multiple links.
@darren-w- - I wasn't able to make your solution work, and I was already using $(document).ready()
0
 
hehdaddyAuthor Commented:
He gave it a good go. I had to take a different route temporarily, but he deserved points for the informational links.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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