[英]How to replace td text in VB.net
I have this code 我有这个代码
<asp:Panel ID="pnlWindHailExclusionDirectDamage" Visible="False" runat="server">
<tr>
<td>
Wind/Hail Exclusion - Direct Damage:
</td>
How can I manipulate the text under td tags under some given condition? 在某些给定条件下,如何处理td标签下的文本? I looked it up before asking but could not find a definitive answer for my question.
我在问之前先查了一下,但找不到我的问题的明确答案。 Under given condition, I want the text to be Wind/Hail Exclusion: instead of Wind/Hail Exclusion - Direct Damage:.
在给定条件下,我希望文本为“风/冰雹排除:”,而不是“风/冰雹排除-直接损坏:”。 Help is appreciated.
感谢帮助。 PS: I looked some javascript examples but could not follow through as i have never done it before.
PS:我看了一些javascript示例,但是由于我从未做过所以无法理解。 Any help is highly appreciated.
非常感谢您的帮助。
I made a quick fiddle demonstrating the concept: http://jsfiddle.net/eBJSe/ -- I used jQuery since you tagged it in the question. 我做了一个小提琴来演示这个概念: http : //jsfiddle.net/eBJSe/-我使用了jQuery,因为您在问题中标记了它。
The code: 编码:
$("#test").click(function() {
$("tr td:first-child").text("Windo/Hail Exclusion:");
});
Since you didn't post the complete table structure, I assumed this was the first td (hence the first-child
selector). 由于您没有发布完整的表结构,因此我认为这是第一个td(因此是
first-child
选择器)。 You can modify this to fit your needs. 您可以修改它以满足您的需求。
Either use Document Object Model (a way to move through an xml document) 要么使用文档对象模型(一种在xml文档中移动的方式)
Or you may use a dirty way and 否则您可能会使用肮脏的方式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.