jquery find to get the first element

前端 未结 6 1433
忘掉有多难
忘掉有多难 2020-12-29 19:11

I am writing $(this).closest(\'.comment\').find(\'form\').toggle(\'slow\'); and the problem is each of the forms in the child is being toggled. I would like on

6条回答
  •  借酒劲吻你
    2020-12-29 19:21

    The simplest way to get the first result of find is with good old [index] operator:

    $('.comment').find('form')[0];
    

    Works like a charm!

提交回复
热议问题