How to loop through all elements of a form jQuery

前端 未结 9 2104
Happy的楠姐
Happy的楠姐 2020-12-14 00:11

I was just wondering what the best way of looping through all the child elements of a form would be? My form contains both input and select elements.

At the moment I

9条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 00:48

    I'm using:

    $($('form').prop('elements')).each(function(){
        console.info(this)
    });
    

    It Seems ugly, but to me it is still the better way to get all the elements with jQuery.

提交回复
热议问题