【问题标题】:jQuery Xpath selector to select an element which id contains 'sometext'jQuery Xpath 选择器选择 id 包含“sometext”的元素
【发布时间】:2011-01-05 18:06:24
【问题描述】:

我在 aspx 页面中有一个列表框元素,它的 id 是 attributesList。

我想选择这个元素来跟踪它的变化事件,但是我不能直接选择它的id,因为asp.net会在运行时改变它的id。

它的id,attributesList变成ctl00_adminPlaceHolder_attributesList。

所以我想做的是使用“包含”xpath 表达式来选择元素。

【问题讨论】:

    标签: asp.net jquery xpath jquery-selectors contains


    【解决方案1】:

    你会想像这样使用"End with" attribute selector

    $("*[id$='attributesList']")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-02
      • 2020-02-05
      • 1970-01-01
      • 1970-01-01
      • 2020-05-27
      • 1970-01-01
      • 2011-11-06
      • 2022-07-01
      相关资源
      最近更新 更多