public List < String > getAttr ( String content , String selector , String attributeKey ) { Element body = parseContent ( content ) ; List < Element > elements = body . select ( selector ) ; List < String > attrs = new ArrayList < String > ( ) ; for ( Element element : elements ) { String attrValue = element . attr ( attributeKey ) ; attrs . add ( attrValue ) ; } return attrs ; }
Retrieves attribute value on elements in HTML . Will return all attribute values for the selector since there can be more than one element .