// 遍历jqgrid 使其序号列宽度为45 function setwidth() { $("table[role='grid']").each(function () {//jqgrid 创建的表格都有role属性为grid $('.' + $(this).attr("class") + ' tr:first th:first').css("width", "45"); //使表头的序号列宽度为40 $('.' + $(this).attr("class") + ' tr:first td:first').css("width", "45"); // 使表体的序号列宽度为40 }); }