开发者

Script works in IE, not working in FF?

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" /开发者_如何学Go>&nbsp&nbsp';

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

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

here's the the html I'm appending to:

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


Firefox, unlike IE, won't infer a tbody element unless there is at least one tr in your table.

So $('#dataTable > tbody') matches nothing and your append has no effect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜