I have following structure
<ul id="tabs" class="nav nav-tabs">
<li><a href="#aaa" hashval="aaa">AAA</a></li>
<li><a href="#bbb" hashval="bbb">BBB</a></li>
<li><a href="#ccc" hashval="ccc">CCC</a></li>
<li><a href="#ddd" hashval="ddd">DDD</a></li>
</ul>
Now I am operating on the anchor tag by following code and which is working fine.
$('#tabs a[href="#ddd"]').tab('show');
I am using pycharm which adds warning for the line by saying "Preface with ID selector". When I click it, pycharm changes to following
$('#tabs').find('a[href="#ddd"]').tab('show');
Both are working fine but I don't understand the difference.
What is the difference in both or more specifically what is difference between $('#tabs a[href="#ddd"]')
and $('#tabs').find('a[href="#ddd"]')
?
question from:
https://stackoverflow.com/questions/17569766/difference-between-tabs-a-and-tabs-finda 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…