Using jQuery, I'm trying to get some text that lives in a remote HTML file.
I'm using filter() with a class of 'copy' to specify which text in the remote file I want to get.
This is my code:
$.get('/article.html', function(data) {
console.log($(data).filter('.copy').text());
});
This seems to work if the element with the class "copy" has no parent. However, if the element has a parent I am unable to get the text. Why is that? And is there a way to filter the response if the element has a parent?