griegs griegs - 7 months ago 29
Javascript Question

jQuery each and keyup

I have several fields on my page all have the same class of say "EntryField".

On the keypress within (any) of these fields I need to itterate through all fields with the class of EntryField.

Can I combine .each on a .keyup or do I need to bind keyup and then within the function of that do an each over the class EntryField?

Answer

Bind keyup an then within the function of that do an each on the class entry field.

$('.EntryField').keyup(function() {
    $('.EntryField').each(function() {
        // do stuff
    });
 });
Comments