这个jQuery代码是什么意思?
$('tr[id^="message"]')
这意味着 - 选择id
属性以字符串开头的所有tr
元素message
http://api.jquery.com/attribute-starts-with-selector/
[]
是指元素的属性(id是一个),id^
是一个通配符,这意味着id必须以"message"开头。
它表示 id 以"message"开头的表行:
$('tr // a table row
[id //having an id
^="message"]') // starting with 'message'
http://api.jquery.com/category/selectors/attribute-selectors/