<script type=“text/javascript”>
$(document).ready(function(){
$(“div”).each(function(){
alert($(this).html() + “—-” + this.tagName + “–” + $(this)[0].id);
alert((this == $(this)[0]));
$(this).attr(“title”, $(this).html());
});
});
</script>
这里出现的this指的是html元素的”div”,用來取得该div的属性。
$(this)则是指jQuery的物件,用來执行jQuery的方法。