html - How to get the path of tag if it has a space in its class or id
问题描述
I am trying to get the path of the tags with class name(using cheerio). I tried
let title =$('div.group-flag > div >a').text();
this works fine.
I am trying to get text required
.
I tried
let title=$('//span[starts-with(@class,"js-course-title")]')
this gives an error.
$('span[class="js-course-title.d-none.d-sm-block"]')
this returns no values (or length=0
). Please let me know how can I get the text required?
解决方案
任何一个
$('[class="c-ad-carousel__subtitle c-ad-carousel__subtitle--location c-ad-carousel__subtitle--small"]')
或者
$('.c-ad-carousel__subtitle.c-ad-carousel__subtitle--location.c-ad-carousel__subtitle--small')
推荐阅读
- ios - 如何为 UIView 添加圆角半径
- maven - HTTP/1.1 401 Unauthorized to upload my module kotlin to jcenter using bintray
- python - 如何用两个arfument函数实现装饰器
- java - Hibernate 中的嵌套 JOIN 查询
- javascript - 从odoo 12中的javascript中选择选择字段的值
- selenium - 从无限滚动网站中抓取内容
- javascript - Angular:类型 ArrayBuffer 不可分配给类型字符串
- python - tensorflow.keras.preprocessing.text.Tokenizer.texts_to_sequences 的 Numpy 数组给出了奇怪的输出, list([2]) 而不是 [[2]]
- multithreading - `mkl_set_num_threads` 会限制 CPU 线程的数量吗?
- mysql - 从有条件的两个表中删除行