How can I select a hidden field by value?

前端 未结 3 2030
闹比i
闹比i 2021-02-06 23:41

I have the following HTML generated by an ASP.NET repeater:

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-07 00:24

    Note: Since jQuery 1.9 the input[value="banana"] selector is no longer valid, because 'value' of the input is technically not an attribute. You need to use the (far more difficult to read) .filter

    E.g.

    $("input").filter(function () {
        return this.value === "banana";
    });
    

    See also: jQuery 1.9.1 property selector

提交回复
热议问题