看个例子:
<a href="http://segmentfault.com/q/1010000000125418" target="_blank" data-id="1010000000125418">jQuery</a>
$('a').click(function(){ this.innerHTM==$(this).html()=='jQuery';//三者是一样的. this.getAttribute('href')==this.href==$(this).attr('href')//三者是一样的; this.getAttribute('data-id')==$(this).attr('data-id')//二者是一样的; });