<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
</script>
<a href="http://www.google.com" id="aGoogle1">Google Link</a>
<script type="text/javascript">
$(function()
{
console.log($('a[href="http://www.google.com"]'));
});
</script>
在chrome-> console中,我可以看到$('a[href="http://www.google.com"]')
返回所選元素,我可以看到它具有以下屬性:id:「aGoogle1」。所以我的問題是:如何在jquery中輸出所選元素的屬性?
如何輸出屬性,例如編號,我試過$('a[href="http://www.google.com"]'.id)
,但它不起作用?