I want to copy the urls (href) of all "a" within a div, but it has many nested elements. How would it be to copy it?
This would be the example:
<div id="enlaces">
<div id="tabla">
<div >
<table>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td>
<a href="http:www.google.com">></a>
</td>
</tr>
<tr>
<td>
<a href="http://www.facebook.com">
</a>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td>
<a href="http://www.google.com"></a>
</td>
</tr>
<tr>
<td><a href="http://www.google.com"></a>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td>
<a href="http://www.google.com"></a>
</td>
</tr>
<tr >
<td><a href="http://www.google.com"></a>
</td>
</tr>
</tbody>
</table>
</td>
<td>
<table>
<tbody>
<tr>
<td>
<a href="http://www.google.com"></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
I tried getElemenById
, but copy everything. And I just want to copy the "a".