带有方括号和插入符号的jQuery代码是什么意思?

这个jQuery代码是什么意思?

$('tr[id^="message"]') 

这意味着 – 选择id属性以message字符串开头的所有tr元素

http://api.jquery.com/attribute-starts-with-selector/

[]引用元素的属性(id为1), id^是通配符,表示id必须以“message”开头。

它表示具有以“message”开头的id的表行:

 $('tr // a table row [id //having an id ^="message"]') // starting with 'message' 

http://api.jquery.com/category/selectors/attribute-selectors/