如何从div中选择特定元素? [英] How do i select specific elements from div?

查看:166
本文介绍了如何从div中选择特定元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从该div获取日期:

I want to get the date from this div:

<div class="pandatacontcol" style=" width:160px;">
    <h6>Date Qualified</h6>
    <p id="QualDate34868684">2013-03-08 12:04:01</p>
</div>

所以输出将是:2013-03-08

我试图这样做:

elements = doc.select("p[id^=\"QualDate\"]");

但它不起作用.

推荐答案

不带引号的尝试

doc.select("p[id^=QualDate]");

属性值设置在引号<tag attribute="value">内,但这些引号不是值的一部分.

Value of attribute is set inside quote marks <tag attribute="value">, but those quote marks are not part of value.

这篇关于如何从div中选择特定元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆