<div id="maintest">
        <div class="t">
            <div>title</div>
            <div class="ch">
                <input type="text name="input1" value="" id="i1">
            </div>
            <div class="t">
                <div>sub title</div>
                <div class="ch">
                    <input type="text name="input2" value="" id="i2">
                </div>
            </div>
        </div>
        <div class="t">
            <div>title2</div>
            <div class="ch">
                <input type="text name="input2" value="" id="i2">
            </div>
        </div>
    </div>

     //  $('#maintest div.t').not('.no div').each(function (index,element) { // 只有第一個
      // $("#maintest").find("div.t").each(function (index,element) {  // 會找到三個
           $("#maintest").children("div.t").each(function (index,element) {  // 會找到2個

           console.log(" L==>index"+index+" ==> " + $(this).html() );
       });

By admin-powenko

Dr. Powen Ko is a teacher and CEO on LoopTek LLC, and like to teaching. if you need to class, please let PowenKo know, he will love to service and sharing. LoopTek web site is www.looptek.com

Leave a Reply