<div id="attribute1" class="attribute">
                            <input type="text" id="txtlayer1" />层<input type="text" id="txtInch1" />寸<input type="text"
                                id="txtPrice1" />元 <a href="#" onclick="addnew(1);return false;" class="add">+</a>
                            <a href="#" onclick="removeold(1);return false;" class="minus">-</a></div>
要用jquery把上面的所有1替换成2
        function addnew(id){
            var newid =id+1;
            var html= jQuery("#attribute"+id).html().replace(id,newid);
            var newhtml = "<div id=\"attribute"+ (id+1) +"\" class=\"attribute\">" + html + "</div>";
            jQuery("#MenuType2").find("tr>td").eq(1).append(newhtml);
        }
结果不理想,只替换了首次,别的没替换掉,结果如下
<div id="attribute2" class="attribute">
                            <input type="text" id="txtlayer2" />层<input type="text" id="txtInch1" />寸<input type="text"
                                id="txtPrice1" />元 <a href="#" onclick="addnew(1);return false;" class="add">+</a>
                            <a href="#" onclick="removeold(1);return false;" class="minus">-</a></div>
有没有一次替换全部的方法