How to get values from DIV data-* attribute

a 夏天 提交于 2021-01-29 18:26:24

问题


I need to get value of data-headline from this html through Java. Tried "getElementsByTag" and "getElementsByClass" but no luck.

  <div class="component template hidden"
    data-id="8943"
    data-page=""
    data-reviews-sort="rating"
    data-reviews-count="0"
    data-ratings-average="0"
    data-rating-counts="[]"
    data-ratings-count="0"
    data-headline="Java Code">

Any quick help is really appreciated.

来源:https://stackoverflow.com/questions/64223069/how-to-get-values-from-div-data-attribute

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!