I use jQuery to iterate over an HTML table and dynamically populate the line numbers of each line (by filling in the line number in the text box):
function updateRowNums() {
$('#myTable').find('tr').each(function(index) {
$(this).find('input[id$="_rowOrder"]').val(index);
});
}
This function is called under:
$(document).ready(function() {
updateRowNums();
});
This works great in Firefox. However, in Chrome (tried both 5.x and 9.x (beta)), and sometimes Safari, this populates a bunch of other fields that don't even match:
'input[id$="_rowOrder"]'
with line numbers. So basically it scatters the numbers around in other unrelated text fields ...
I am sure this is some kind of Chrome or jQuery bug, but I am just checking as this seems like pretty simple functionality. By the way, if I enter a warning in the code, then it works fine in Chrome, so this may have something to do with the load time of the document in Chrome:
function updateRowNums() {
$('#myTable').find('tr').each(function(index) {
alert("XXXXXXXXXXXXXXXXXXX");
$(this).find('input[id$="_rowOrder"]').val(index);
});
}
, :
http://jsfiddle.net/eGutT/6/
, , :
- URL- Chrome ( Safari - ).
- , , , ( 1- )
- "".
- ,
, , , . :
one_rowOrder
two_rowOrder
three_rowOrder
, 3 . , 5 .
,