views:

34

answers:

1

Hello,

I have a query invoice which only updates the total values when a field is altered. As I am generating the invoice items using PHP I really need the values to update as soon as the HTML is generated.

How can I call the update_total function the moment the document has finished rendering?

Thanks,

Tim

+1  A: 

This code will run the update_total function as soon as the page has completely loaded.

$(document).ready(function() {
    update_total();
});

You can read more on the .ready method here: http://api.jquery.com/ready/

Shane Reustle
Ahh it was staring me in the face the whole time! Thanks!
Tim
Or the very terse, obfuscated `$(update_total);` :)
Jarrod Dixon