jQuery best way to apply eventhandlers
<p>I'm working on a grid with 20 columns and 100+ rows. Every column has an input field. Now I want to put eventHandlers on the input fields like <code>change</code> and <code>keyup</code>, <code>focus</code>, and much more. So there can be 20*100 events = 2000!</p>

<p>What is the best way to do this? I've read something about eventHandlers and memory problems. </p>

<p>This is how I think I should do it:</p>

<pre><code>$("#grid input").each(function() {
    $(this).keyup(function() {
        // 
    });
    $(this).change(function() {
        // 
    });
});
</code></pre>

<p>Or is this the best way to do it?</p>

<pre><code>$("#grid").keyup(function() {
        // 
});
</code></pre>