Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: jquery 或 css 选择器?选择所有以
我需要选择以 id 开头的所有元素"Monday_",例如id="Monday_16"
"Monday_"
id="Monday_16"
您可以使用attribute starts with选择器:
attribute starts with
$("[id^='Monday_']");
或更好:
$("tagname[id^='Monday_']");
http://api.jquery.com/category/selectors/
您可以使用以选择器开头的属性来完成此操作:
$('[id^="Monday_"]')