Element tables = doc.select("table")
Elements myTds = tables.select("td:eq(0)");
.....
thetext=td.text();
thehref=td.getElementsByTag("a[href]");
I am reading a table from a HTML page. I want to read the
<td>
<a href="student-profiles/andy.html">Andy</a>
</td>
I want to read Andy and student-profiles. thetext is printing Andy. How can I get the href? I tried a couple of things but could not.
//thehref=td.getElementsByTag("a");
function simpleURL(){
var anchors = document.getElementsByTagName('a');
if(anchors != null & anchors.length > 0){
thehref= anchors[1].href;
}
}
I was able to do this:
Elements myTds = tables.select("td:eq(0)"); than on tds.attr(href);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.