Skip to content Skip to sidebar Skip to footer

Getting Attribute Value From Div Tag Through Jsoup

I have a Div tag as below
5 days 07:14:41
How do i get the value of

Solution 1:

Elementdiv= doc.getElementById("eventTTL");
Stringattr= div.attr("eventTTL");
System.out.println(attr);

More info at: https://jsoup.org/cookbook/extracting-data/attributes-text-html

Solution 2:

In case if your DIV has no Id:

Element div = doc.select("div[eventTTL]").first();
System.out.println(div.attr("eventTTL"));

Post a Comment for "Getting Attribute Value From Div Tag Through Jsoup"