Here you can find the source of addStyle(Element element, String styleToBeAdded)
Parameter | Description |
---|---|
element | - to which style have to be added. |
styleToBeAdded | - style which will be added. |
public static void addStyle(Element element, String styleToBeAdded)
//package com.java2s; //License from project: LGPL import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Main { /**/*from w ww . j a va 2 s . c om*/ * Constants for attribute names. */ public static final String ATTRIBUTE_STYLE = "style"; /** * Add style to existing one. * * @param element * - to which style have to be added. * @param styleToBeAdded * - style which will be added. */ public static void addStyle(Element element, String styleToBeAdded) { String style = element.attr(ATTRIBUTE_STYLE); style += styleToBeAdded; element.attr(ATTRIBUTE_STYLE, style); } /** * Add style to <code>elements</code>. * * @param elements * - list with elements where style have to be added. * @param styleToBeAdded * - style which will be added. */ public static void addStyle(Elements elements, String styleToBeAdded) { for (Element element : elements) { addStyle(element, styleToBeAdded); } } }