I have section
and article
for displaying contents. My code is:
<section id = "examples">
<article id="item_1">
...
</article>
<article id="item_2">
...
</article>
<article id="item_3">
...
</article>
<article id="item_4">
...
</article>
...
</section>
I am trying to get the id's of the articles
so that I can compare, but I am getting undefined. My code is:
var compare = "item_1"
$('article').each(function(){
var pos = $('article').id;
console.log(pos) //getting undefined
if( pos == compare)
// do something
});