jQuery each和keyup [英] jQuery each and keyup

查看:80
本文介绍了jQuery each和keyup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我页面上的几个字段都具有相同的"EntryField"类.

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

在这些字段(任意)中的按键上,我需要遍历所有带有EntryField类的字段.

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

我可以将.each组合到.keyup上吗,还是需要绑定keyup,然后在该函数内对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?

推荐答案

绑定键,然后在该键的功能之内对类输入字段进行每次操作.

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
    });
 });

这篇关于jQuery each和keyup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆