I have a simple function to re-create id's in a table but it's not giving me the expected output. I am by no means an expert in jquery so it's probably something simple.
$("#myTable tr").each(function (index) {
if (index > 0) {
$(this).find(".tdWithId > input").val(index);
console.log($(this).find(".tdWithId > input").val());
}
});
In the console output, the values look correct (1, 2, 3, etc.), but when I inspect the html I still see the previous values (value="1", value="2", value="4", etc.).
What am I missing?
Update:
When I do this from console after the fact you can see what I mean.
$(".tdWithId>input").val();
output: "1"
$(".tdWithId>input")
output: [<input name="[0].Details[0].ID" type="text" value="2">]
tdwith aninputper row?td > inputselector into the main selector for youreach. Still wouldn't hurt to have the html or a fiddle or something.