I have a Div tag as below
<div id="eventTTL" style="text-transform: uppercase; font-weight: 900;" eventTTL="4583476000">5 days 07:14:41</div>
How do i get the value of eventTTL? I want to display the value of eventTTL ie:) "4583476000".
Element div = doc.getElementById("eventTTL");
String attr = div.attr("eventTTL");
System.out.println(attr);
More info at:https://jsoup.org/cookbook/extracting-data/attributes-text-html
In case if your DIV has no Id:
Element div = doc.select("div[eventTTL]").first();
System.out.println(div.attr("eventTTL"));
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.