Select elements with an attribute with cheerio

后端 未结 2 1689
时光取名叫无心
时光取名叫无心 2021-02-19 09:23

What is the most efficient way to select all dom elements that have a certain attribute.


With plain javascript I wo

2条回答
  •  遥遥无期
    2021-02-19 10:13

    For some reason, the accepted answer didn't work for me (using cheerio ^1.0.0-rc.2 here).

    But for the following markup:

    
    

    this did work:

    $('input[name="data[text_amount]"]'));
    

    The double quote did the magic. Got that from cheerio's help docs.

提交回复
热议问题