Building on the accepted answer:
It depends on what kind of pattern you're looking for. If your pattern is something like "MasterPageElement_CheckBox_4443", "MasterPageElement_CheckBox_4448", etc. then you could also use:
$("span[id^=MasterPageElement_CheckBox]")
There are 3 built-in attribute selectors for simple patterns:
$("span[id^=foo]")
That selector matches all spans that have an id
attribute and it starts with foo
(e.g. fooblah
)
$("span[id$=foo]")
That selector matches all spans that have an id
attribute and it ends with foo
(e.g. blahfoo
).
$("span[id*=foo]")
That selector matches all spans that have an id
attribute and it has foo
somewhere within in it (e.g. blahfooblah
).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…