看个例子:
<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')//二者是一样的;
});
本文通过一个具体的示例展示了如何使用jQuery操作DOM元素,包括点击事件处理、获取元素属性值等,有助于理解jQuery简化DOM操作的方式。

被折叠的 条评论
为什么被折叠?



