How to select div tag inside an anchor tag. Consider the following HTML.
<a target="_new" href="https://stackoverflow.com/12.mp4"
data-placement="top" rel="tooltip"
title="Video (MP4)" >
<div class="hidden">Interesting 12</div>
</a>
I have to select all anchor tags pointing to video resource. I am able to select the anchor tags. Now How do I select the division inside it and get the text?
$("a").each(function() {
var link = $(this).attr('href');
if (typeof link == "string" && link.indexOf(".mp4") > 0) {
alert(link);
}
})
use
.find('div')or.find('.hidden')after your$('a')http://api.jquery.com/find/