memoak
memoak

Reputation: 41

Execute jQuery after other scripts?

I'm trying to use jQuery to change some styling on my page. The page is made dynamically by executing another JavaScript file.

Right now I have

$(window).load(function(){
    $('p').css('font','green');
});

Which does nothing.

$(document).ready(function() will change the static part of the page, but not the generated part.

If I just type $('p').css('font','green'); in the console, the expected results will happen. What is going on?

Upvotes: 4

Views: 575

Answers (2)

wombleton
wombleton

Reputation: 8376

Instead of listening for the document ready event, can you listen to an event fired by a workcomplete script building the page?

Or can you test for something in the page to indicate it's done every 100ms and then fire such an event yourself?

Upvotes: 0

Andir
Andir

Reputation: 2083

I'm guessing you are asking to be able to bind events to objects?

If so, look up the jQuery live() function: http://api.jquery.com/live/

If you are simply trying to apply CSS Styles to the page, you're better off relying on actual CSS style sheets.

Upvotes: 4

Related Questions