user730569
user730569

Reputation: 4004

What jQuery method do I put here if I want it to be triggered right when the page is loaded?

What do I replace the question marks with if I want the class to be added when the page is loaded?

$("form#signupform input#email").live("????", function() {
    $(this).addClass("launchrock");
});

Upvotes: 1

Views: 135

Answers (2)

samccone
samccone

Reputation: 10926

$(window).load(function(){...}); is called when the images have loaded, $(document).ready(function(){...}); will be called as soo as the js/css/dom has been loaded and can execute

read this for more information tho

http://4loc.wordpress.com/2009/04/28/documentready-vs-windowload/

Upvotes: 0

alex
alex

Reputation: 490403

You'd replace more than that.

$(window).load(function() {
    $("form#signupform input#email").addClass("launchrock");
});

Assuming by page you mean page with all assets; if not, use $(function() { ... }) which only waits for the DOM API to be ready for use.

Upvotes: 3

Related Questions