I have the following code which takes me all the addresses.
I only need addresses that contain text.
Ex:
<a href="https://www...." target="_blank">Text...</a>
But the problem that there are addresses that contain an image, these addresses I would like to exclude them.
Ex:
<a href="http://www..." target="_blank"><img src="http://www." border="0" alt=""></a>
$("div#posts > div > div > div > div > table > tbody > tr:nth-child(2) > td:nth-child(2) > div:nth-child(3)").each((_idx, el) => {
$(el).find('a').each((_idx, el) => {
let u = $(el).attr('href')
if(u.includes("http")) element.add(u);
})
})
Can you give me a hand?
You can use filter:
$('a').get().filter(a => $(a).text().match(/\w/)).map(a => $(a).attr('href'))