I have a situation where I have a HTML table
.
It has some td
.
Every td has some text and two hidden field
.
I have a json source
for my table td text.
I want to change the text of the all the td of the table without changing the two hidden field.
Earlier I was using jTemplate and json for the same.
But I was bringing the hidden field values in the Jason for every td which was not different from the original value.
So I decided to change my approach to bring only the text which need to be replace.
I know how to change the text of the td in jQuery using text()
and html()
method.
But will it change the text without affecting the controls (hidden field) inside td?
---edit ---
One of my td is like
<table id='demoTable'>
<tr>
<td>8: Tap on APN and Enter <B>www</B>.
<INPUT id=h150000000000000109743 class=hid value="test value" type=hidden>
<INPUT id=h250000000000000109743 class=hid1 value="26,222,98,10,50000000000000109744,T,~25,221,99,10,,T,www" type="hidden">
</td>
</tr>
</table>
And my jquery is like this
function changeText() {
$("#demoTable td").each(function () {
for (var i = 0; i < $(this).children.length; i++) {
alert($(this).children(i).val());
}
// alert($(this).html());
// $(this).text("hello");
//alert($(this).html());
});
}