我有一个嵌套的列表视图,其中包含多行,每行都包含一个 ddl 和一个文本框,例如:
<ItemTemplate>
<tr>
<td>
<asp:DropDownList id="myDDL" runat="server" CssClass="aDDL"
onfocus="javaScript:$(function() {
$(<selector>).siblings.RemoveClass('wrappedElement');
$(<selector>).addClass('wrappedElement');
})" /></td>
<td><asp:TextBox id="myTextBox" runat="server" CssClass="aTextBox"
onfocus="javaScript:$(function() {
$(<selector>).siblings.RemoveClass('wrappedElement');
$(<selector>).addClass('wrappedElement');
})" /></td>
</tr>
</ItemTemplate>
我想要做的是包装被点击的元素。发生的事情是我包装了所有“aDDL”或“aTextBox”元素。我需要找到刚刚关注的元素的选择器。
我试过这篇文章,但“this”或 $(this) 最终指向整个文档。