`

jQuery each获取表格数据

阅读更多
			 *设置每行第一列的宽度
			 */
			//方式一:<span style="background-color: rgb(255, 255, 255); ">遍历表格每一行,选择器第一列设置样式</span>

			$("#Table2 tr").each(function(){ 
				$(this).children("td:first").attr("style","width:80px;"); 
			})&nbsp;

			//方式二:<span style="background-color: rgb(255, 255, 255); ">原理同上,方法稍有不同而已</span>
			$("#Table2 tr").each(function(){
			    var $thisTr = $(this);
			    var $thisFirstTd = $("td:eq(0)",$thisTr );
			    $thisFirstTd.attr('style','width:80px;');
			});


$("table:eq(1) tr:gt(2)").each(function(){console.log($.trim($(this).children("td:eq(0)").text()))})

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics