关于jquery 根据标签属性值模糊查询html标签对象集合的处理

如果你通过Contains找到,那么它会是这样的

$("input[id*='DiscountType']").each(function (i, el) {
    //It'll be an array of elements
});

如果你找到Starts With,那么它会是这样的

$("input[id^='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
});

如果你是通过Ends With找到的话,它会是这样的

  $("input[id$='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     });

如果你想选择id不是给定字符串的元素

  $("input[id!='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     });

如果要选择id包含给定单词的元素,用空格分隔

  $("input[id~='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     });

如果你想选择id等于给定字符串的元素,或者从该字符串开始,然后连字符

  $("input[id|='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     });

 

你可能感兴趣的:(jquery,javascript,jquery)