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.
下面的表达式是否意味着它将给我所有 id 包含单词框的 div 对象?
$("div[id*='box']")
是的,您是正确的,它的意思是所有在其属性$("div[id*='box']")中包含box单词的div 对象。id
box
id
您还可以检查-属性以框字开头的$("div[id^='box']")所有 div 对象idLike 'box1', 'box-data'.
$("div[id^='box']")
Like 'box1', 'box-data'.
$("div[id$='box']")id- 所有属性以 box word 结尾的div 对象like 'white-box', 'new-box'
$("div[id$='box']")
like 'white-box', 'new-box'
很简单,是的:-) 没有什么要补充的了,你是对的。