【问题标题】:How can i call aria-label if it start with "Example"如果它以“示例”开头,我如何调用 aria-label
【发布时间】:2020-01-10 10:43:57
【问题描述】:

我正在努力解决这个难题。

我有这个脚本:

$('button[aria-label="Exam"]').trigger('click');

但我还需要获取所有以 Exam 开头的内容,例如“Exam 1”或“Exam 202”。

【问题讨论】:

    标签: javascript jquery web-frontend


    【解决方案1】:

    您可以使用Attribute Starts With Selector [name^="value"]选择具有指定属性且值正好以给定字符串开头的元素

    $('button[aria-label^="Exam"]').trigger('click');
    

    【讨论】:

      猜你喜欢
      • 2014-03-29
      • 1970-01-01
      • 2019-10-21
      • 2021-09-25
      • 1970-01-01
      • 2022-06-10
      • 1970-01-01
      • 2014-03-06
      • 2014-05-13
      相关资源
      最近更新 更多