jquery 动态表相关
jquery 点击button 然后获取所在是第几行:$('#delRuleButton').click(function(){ var rowIndex = $(this).closest("tr").index(); alert('当前行数为='+rowIndex);});如何解决rowspan = 4 行情况 的删除://点击【删除评分规则】按钮$('#delRuleButton').click(function(){hintMsg("addRuleButton", "");renameField("qualitativeRuleListTab",1); //rename表名var f_qualitativeRuleListTab=document.getElementById('qualitativeRuleListTab');//var rowLen = f_qualitativeRuleListTab.rows.length; //获取表的行数var selFlag = false;$('input[type=checkbox][id=selQuesBankId]').each(function(){ //循环checkBoxif($(this).attr("checked")==true){//取勾选的框//var v = $(this).attr("value");selFlag = true ;var rowSpanNum = $(this).attr("readOptionNum");//获取rowSpan的值var rowIndex = $(this).closest("tr").index();//获取当前触发事件的行号var num = parseInt(rowSpanNum);//alert('rowIndex='+rowIndex+' rowSpanNum='+rowSpanNum);for ( var j = num -1 ; j >= 0; j--) {var m = parseInt(rowIndex) + j; //行从最后一条往前删除,防止编号出错f_qualitativeRuleListTab.deleteRow(m);}}});//alert('selFlag='+selFlag);if (!selFlag) {showMsg("delRuleButton", "请至少勾选一条信息!");//用来校验删除前是否有勾选return false;}});