gpt4 book ai didi

javascript - 在其他类(class)之后将内容导入类(class)

转载 作者:行者123 更新时间:2023-11-28 18:34:18 25 4
gpt4 key购买 nike

是否可以使用 jQuery 将嵌套元素的文本存储在变量中?就我而言,内容是“SEO SEM”。

我唯一的引用是第一个名为 event_490 的类,我想获取类 evcal_event_title 等于“Seo SEM”的子元素的内容.

Example image

<div class="evo_lightbox_body eventon_list_event evo_pop_body evcal_eventcard event_489">
<div class="evopop_top" style="border-left-width: 3px; border-left-style: solid; border-left-color: rgb(33, 119, 189);">
<span class="ev_ftImg" data-img="http://localhost/academia/wp-content/uploads/2016/05/JBW2PXDOL6.jpg" data-thumb="http://localhost/academia/wp-content/uploads/2016/05/JBW2PXDOL6.jpg" style="background-image:url(http://localhost/academia/wp-content/uploads/2016/05/JBW2PXDOL6.jpg)"></span>
<span class="evcal_cblock " data-bgcolor="#2177bd" data-smon="junho" data-syr="2016">
<em class="evo_date">
<span class="start">11<em>jun</em>
</span>
<span class="end"> - 12</span>
</em>
<em class="evo_time">
<em class="evo_day">jun 11</em>
<span class="start">9:00</span>
<em class="evo_day end">jun 12</em></em>
<em class="clear"></em>
</span>
<span class="evcal_desc evo_info hide_eventtopdata " data-location_status="false">
<span class="evo_above_title"></span>
<span class="evcal_desc2 evcal_event_title" itemprop="name">Digital Stratety</span>
<span class="evo_below_title">
<span class="evcal_event_subtitle">09:00 - 18:00 | 16h | 155€</span>
</span>
<span class="evcal_desc_info"></span>
<span class="evcal_desc3"></span>
</span><em class="clear"></em>
</div>
</div>

最佳答案

如果页面中的类不重复,您可以只使用类选择器 .text() 函数:

$('.event_490 .evcal_event_title').text();

希望这有帮助。

关于javascript - 在其他类(class)之后将内容导入类(class),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37417484/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com