jq基础知识

遍历选中每个td
$('table tr').find('td').each(function () {}
遍历选中每行第一个td
$('table tr').find('td:first').each(function () {}
遍历选中每行第二个td
$('table tr td:nth-child(2)').each(function () {}

 

获取选中下拉框值:
$("select option:checked").val();

获取选中单选框值:
$('input:radio:checked').val();

获取单个复选框选中的值:
$('input:checkbox[name="_gs_id"]:checked').val();
获取循环复选框选中的值:
var id_array= [];
$(':checkbox:checked').each(function(){
id_array.push($(this).val());
});
var ids = id_array.join(',');

posted @ 2018-03-22 11:24  lomi  阅读(101)  评论(0编辑  收藏  举报