jquery 模糊查询对象属性

1.如果你需要查询的对象属性id的值包含这样的值,你可以这样读取所有此条件的对象

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

2.如果你需要查询的对象属性id的值以DiscountType起始位置开始,你可以这样读取所有此条件的对象

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

3.如果你需要查询的对象属性id的值以DiscountType结束,你可以这样读取所有此条件的对象

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

4.如果你需要查询的对象属性id的值不等于DiscountType,你可以这样读取所有此条件的对象

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

5.如果你需要查询的对象属性id的值包含DiscountType,以空格分隔,你可以这样读取所有此条件的对象

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

6.如果你需要查询的对象属性id的值是等于给定字符串或以该字符串后跟一个以连字符开始的值,你可以这样读取所有此条件的对象

     $("input[id|='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     }
原文地址:https://www.cnblogs.com/david1989/p/3759705.html