遇到麻烦,请使用jQuery选择我的ListView的兄弟值。这里是我尝试的jQuery语法,但是当我在firebug中写入控制台时进行调试时,它表示一切都未定义,但是当我查看html时,我可以看到它们中的值,所以我知道它们只是不选择它们。它正在被更新按钮的点击事件调用,我需要抓住我更新的行的列表视图中的不同行的兄弟姐妹。选择HTML的兄弟值
$('.nbr')
.click(function){
var newaddr = $(this).siblings('#addr').val();
var originaladdr = $(this).siblings('#addr').attr('data-Value');
var newplace = $(this).siblings('#place').val();
var originalplace = $(this).siblings('#place').attr('data-Value');
的ListView:
<asp:ListView runat="server" id="ListView1" >
<LayoutTemplate>
<table id="tablesorter" style="border:solid 1px black;width:55%;">
<thead>
<tr>
<th>
<a href="#">Addr</a>
</th>
<th>
<a href="#">Place</a>
</th>
</tr>
</thead>
<tbody>
<tr id="itemPlaceholder" runat="server" />
</tbody>
<tfoot>
</tfoot>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<input maxlength="3" size="4" type="text" id="addr" data-Value="" value="<%# Eval("addr")%>" />
<input maxlength="4" size="4" type="text" id="place" data-Value="" value="<%# Eval("place")%>" />
</td>
<td>
<input type="button" class="nbr" id="btn_update" value="Update" />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
什么是'this'在这种情况下?这段代码叫什么名字? –
你的html结构很奇怪。而这是什么? – pktangyue
可以请你发布生成的HTML? –