<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool在线教程(w3cschool.cn)</title>
<script src="/statics/js/jquery-1.8.3.min.js"></script>
</head>
<body>
<div id="n1">
<p id="n2" class="test"></p>
<p id="n3" class="detail">
<span id="n4" class="test codeplayer"></span>
</p>
</div>
<script>
jQuery.fn.showTagInfo = function(){
var tags = this.map( function(){
return this.tagName + ( this.id ? "#" + this.id : "" );
} ).get();
$("body").append( tags.join("<br>") + "<br><br>" );
};
$("#n1,#n2,span.test").showTagInfo();
$("p.detail, .test").showTagInfo();