`

jquery 可见性选择器 与初探html() 与 text()的区别

阅读更多
<script src="../scripts/jquery-1.3.1.js" type="text/javascript"></script>
 <script type="text/javascript">
	$(function(){
		$("tr:hidden").each(function(){
			alert($(this).html()); //返回 <td>Value 1</td>
			alert($(this).text()); //返回 Value 1
		});

		$("tr:visible").each(function(){
			alert($(this).html());  //返回 <td>Value 2</td>
			alert($(this).text());  //返回 Value 2
		});
	});
 </script>
</head>
<body>
  <table>
	  <tr style="display:none"><td>Value 1</td></tr>
	  <tr><td>Value 2</td></tr>
	</table>
</body>
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics