JSOUP - Getting value of textarea from HTML - CLOSED

坚强是说给别人听的谎言 提交于 2019-12-25 08:57:48

问题


I've just started using JSOUP and I'm trying to get the value in the textarea. The below is the element info from the HTML;

The below is the code that I'm using to attempt to read the value in the textarea;

    try {
        String html = "http://aviprobo.doorfree.com/control.html";
        Document doc = Jsoup.connect(html).get();
        Element textarea = doc.getElementById("control");
        System.out.println("textarea value = " + textarea.val());
    } catch (IOException e) {
        //
    }

The value of textarea.val() is empty. Could someone please point me in the right direction. Thanks.


回答1:


Document doc = Jsoup.connect("http://sports.163.com/13/0830/22/97IFSI5I00051CD5.html").get();

**Entities.EscapeMode.base.getMap().clear();**

Elements elements = doc.select("textarea[id^=photoList]");

for(Element e:elements){
    System.out.println(e.html());
}


来源:https://stackoverflow.com/questions/20736303/jsoup-getting-value-of-textarea-from-html-closed

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