我有一个看起来像这样的 html 文档:
<div id="panel_comments">
<table id="panel_comments_table">
<tr>
<td style="width: 150px;">Monday: </td>
<td><textarea id="panel_comments_monday" rows="4" cols="60" >Monday comment area</textarea></td>
</tr>
.. same with the other 6 weekdays
</table>
</div>
现在,如果我想选择所有文本区域,我会使用自然语言执行以下操作give me all elements which are textareas, with the following ids
::
$("textarea [id^=panel_comments_]")
但它给了我一个空的结果。相反,我必须像这样重新排列选择器,这是一种自然语言give me all elements with the ids, and which are textareas
:
$("[id^=panel_comments_] textarea")
为什么选择器的顺序很重要?