I can do something like this:
console.log($('.container .content').text());
But I cannot do something like this:
console.log($('.container .content')[0].text());
I got a TypeError: $(...)[0].text is not a function
. Why does this happen? How can I get the text of the first element in the selected jquery array?
SNIPPET:
console.log($('.container .content').text());
<div class="container">
<p class="content">
Contents
</p>
</div>
<div class="container">
<p class="content">
Contents
</p>
</div>