Hehe :)
Look, event methods work like this.... you pass in a function, and
that function will be executed then the event occurs...

$("select").change(function() {
    // code that gets executed when change event the occurs on any
SELECT element
});

But, if you leave out the argument, then the change method does
something completely different... it triggers the event... (as if you
changed the selected OPTION(s) yourself)

$("select").change();

What the guys at jQuery did in that example is, they first defined the
onchange handler, and then triggered it right away... So you got that
red "Candy Caramel" text on page load without having to change the
SELECT...

Reply via email to