How do I iterate through children elements of a div using jQuery?

后端 未结 7 1430
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 01:28

I have a div and it has several input elements in it... I\'d like to iterate through each of those elements. Ideas?

7条回答
  •  春和景丽
    2020-11-28 02:02

    It can be done this way as well:

    $('input', '#div').each(function () {
        console.log($(this)); //log every element found to console output
    });
    

提交回复
热议问题