代码之家  ›  专栏  ›  技术社区  ›  Ben G

循环使用给定类名的元素

  •  -1
  • Ben G  · 技术社区  · 16 年前

    使用jquery,如何遍历给定类中的所有元素?

    2 回复  |  直到 16 年前
        1
  •  3
  •   tvanfosson    16 年前

    使用 each

    $('.klass').each( function() {
        $(this)... // will be an instance of the element matching the class selector
    });
    
        2
  •  2
  •   Major Productions    16 年前

    如有疑问,请查看文档: http://api.jquery.com/each/