1

单击后,我使用以下代码添加表格行,但添加行后,数字功能不再起作用。有什么问题?

数字函数是一个插件,只允许在输入框中输入有效的数字。

这是jQuery代码

var count = 1;
    $('.Outlettbl').delegate('.addbtn', 'click', function(){
        count++;
        var brandid = $(this).closest('tr').find('input[name="brandelement"]').val();
        var rowtoadd = '<tr><td colspan="6" height="5"></td></tr><tr><td width="150"><input type="text" name="Outname['+brandid+'][]" class="required" style="width:140px; height:27px;" /><input type="hidden" name="brandelement" value="'+brandid+'"</td><td width="185"><input type="text" name="Outaddress['+brandid+'][]" class="required" style="width:175px; height:27px;" /></td><td width="100"><input type="text" name="Outcode['+brandid+'][]" class="numeric required" style="width:90px; height:27px;" /></td><td width="110"><input id="otel'+brandid+'_'+count+'" type="text" class="fgray" name="Outtel['+brandid+'][]" onfocus="clearText(\'otel'+brandid+'_'+count+'\', \'optional\');" value="optional" style="width:100px; height:27px;" /></td><td width="165"><input id="ohour'+brandid+'_'+count+'" type="text" class="fgray" name="Outhour['+brandid+'][]" onfocus="clearText(\'ohour'+brandid+'_'+count+'\', \'optional\');"  value="optional" style="width:155px; height:27px;" /></td><td>&nbsp;<a href="javascript:;" class="addbtn addrow'+brandid+'">&nbsp;</a></td></tr>';
        $(this).closest('tr').after(rowtoadd);
        $(this).replaceWith('<a id="row" href="javascript:;" class="delrow">&nbsp;</a>');
            return false;
    });
4

0 回答 0