[JQuery] under each column grab grid components

Summary: [jQuery] caught under the grid assembly (input or non-input)


Caught underneath each column grid tr, then grab the inside of each column to add to the total input

.

$("table[id*=gvMain] tr").each(function () {
                    //如果该列的checkbox有打勾的话                  
                    if ($(this).find("input[id*='chk'][type='checkbox']").attr('checked')) {
                        //就把该列的隐藏金额字段加总
                        var trValue = $(this).find("input[id*='hidAmt'][type='hidden']").val();
                        //alert('trValue:' + parseInt(trValue));
                        if (trValue != "") {
                            totalAmt += parseInt(trValue);
                            //alert('加总一次totalAmt之后:' + totalAmt);
                        }
                    }
                });
//上面的 
$("table[id*=gvMain] tr").each(function () {
});
//也可以改写成
var gvMain = $("table[id*=gvMain]");
gvMain.find('tr').each(function () {
});

If you want to direct control grid which certain input (here refers to the checkbox), do not go through each column tr, then, is as follows:

$("table[id*=gvMain] tr td>input[id*='chk'][type='checkbox']").click(function () {
});

From the above, if you want to really specified input td of the next layer, then, to add> Symbol

Like td> inputOOXX

If you want to specify perhaps td next two or three of the next input

It is td inputOOXX.

Of course, the above can be rewritten as follows

var gvMain = $("table[id*=gvMain]");
gvMain.find("td>input[id*='chk'][type='checkbox']").click(function () {
});

Today there is a deeper understanding of jQuery Selector!

Original: Large column  [jQuery] grasping bottom of each column grid components


Guess you like

Origin www.cnblogs.com/chinatrump/p/11496759.html