Change() inside each() jQuery

前端 未结 4 2112
抹茶落季
抹茶落季 2020-12-18 06:36

What is the best way to manage this kind of situation :

$(\'.element\').each(function() {

    $sibling = // find a sibling to $this.
    $mainElement = $(         


        
4条回答
  •  粉色の甜心
    2020-12-18 07:31

    $('.element .sibling').each(function( ind, el) {
    
        $parent = $( el ).closest( '.element' );
        $( el ).change(function() {
             $parent.doSomething();
        });
    
    });
    

提交回复
热议问题