gpt4 book ai didi

javascript - 获取TD标签的具体值

转载 作者:行者123 更新时间:2023-12-02 19:49:01 25 4
gpt4 key购买 nike

如何隐藏表格中的特定 TD?

渲染页面:

<table>
<tr>
<th>Codigo</th>
<th>Tipo</th>
<th>(L/V)</th>
<th>Endereco</th>
<th>Propostas Ativas</th>
<th>Cons</th>
</tr>
<tr>
<td>373054</td>
<td>Apartamento</td>
<td>V</td>
<td>Rua DO FURQUIM</td>
<td>1</td>
<td>0</td>
</tr>
</table>

ASP页面:

<asp:GridView ID="grdImoveis" Width="100%" runat="server" AutoGenerateColumns="false" DataSourceID="dsGrid" OnRowDataBound="grdImoveis_DataBound">
<Columns>
<asp:BoundField HeaderText="Código" DataField="Imovel_Id" />
<asp:BoundField HeaderText="Tipo" DataField="TipoDsc1" />
<asp:BoundField HeaderText="(L/V)" DataField="TransacaoSigla" />
<asp:TemplateField HeaderText="Endereco">
<ItemTemplate>
<%# Eval("Descricao") %> <%# Eval("Logradouro") %>, <%# Eval("Numero") %> - <%# Eval("Expr1") %> <%# Eval("Complemento") %>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Propostas Ativas" DataField="NumeroProposta" />
<asp:BoundField HeaderText="Cons" DataField="FoundInSanNegocio" />
</Columns>
</asp:GridView>

绘图(示例):

Código      Tipo          (L/V)      Endereço         Propostas Ativas        Cons
373054 Apartamento V Rua Do Furquim 1 0

我想通过 JQuery 获取最后一列的值(缺点),但用户看不到这一列。如何隐藏并获取每行中该列的值?

最佳答案

最简单的方法是:

  $(document).ready(function(){
$('#<%=grdImoveis.ClientID %>').find('tr').each(function(){
$(this).find('td:last').hide();
});
});

要获取点击或其他事件的值,您可以使用:

 var value= $(this).find('td:last').text();

关于javascript - 获取TD标签的具体值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9535155/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com