Скрипт работает в IE, не работает в FF? - PullRequest
0 голосов
/ 30 ноября 2010
function AddRow(){
var rowCount = $("td.RowClass").length;
var currentIndex = 0;
if (rowCount > 0)
{
    currentIndex = rowCount--;
}

var markup = '<tr>';
markup += '<td class="RowClass" style="width:250px"><input type="text" id="TomId' + currentIndex + '" maxlength="78" size="70" /></td>';
markup += '<td><input style="width:245px" type="text" id="SerialNumber' + currentIndex + '" maxlength="30" size="25" />&nbsp&nbsp';

if (currentIndex >= 1) 
{
    markup += '<a id="removeTom' + currentIndex + '" href="#" onclick="RemoveTomControls(' + currentIndex + ')">Remove</a>';
}

markup += '</td></tr>';
$('#dataTable > tbody').append(markup);
}

вот HTML, к которому я добавляю:

<div style="height:340px; overflow:auto;">
            <table id="dataTable" style="margin:0px 1px 10px 5px; margin: width:800px;"> 
            </table>
       </div>

1 Ответ

3 голосов
/ 30 ноября 2010

Firefox, в отличие от IE, не будет выводить элемент tbody, если в вашей таблице не будет хотя бы одного tr.

Так что $('#dataTable > tbody') ничего не соответствует и ваше добавление не имеет эффекта.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...