如何使用 jquery 根据多个名称的子字符串过滤元素,我在下面尝试但没有成功:

How to filter elements based on substring of multiple name using jquery, I tried below but not worked:

我尝试了以下方法但没有成功:

$( "input[id][name*='Address.Line1'][name*='Address.Line2'][name*='Address.City'][name*='Address.StatesList'][name*='Address.CountryList'][name*='Address.PostalCode']")

我需要所有基于 "OR" 条件的元素。

请帮忙。

为此使用 comma separated multiple selectors

$("input[id][name*='Address.Line1'],input[id][name*='Address.Line2'],input[id][name*='Address.City'],input[id][name*='Address.StatesList'],input[id][name*='Address.CountryList'],input[id][name*='Address.PostalCode']")

使用filter()方法使其更具可读性。

$( "input[id]").filter("[name*='Address.Line1'],[name*='Address.Line2'],[name*='Address.City'],[name*='Address.StatesList'],[name*='Address.CountryList'],[name*='Address.PostalCode']");