天天看點

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()))})