[OFF] Prototype JS
07/10/2011 09:33
function addItem() {
var clone = $('item_clone').clone(true);
var htmlId = 'itensList['+childCount+'].';
clone.childElements().each(function(element) {
var cod = element.identify();
if (cod === "itensList[_clone].pedidoVenda.pk") {
element.writeAttribute('id', htmlId+'pedidoVenda.pk');
element.writeAttribute('name', htmlId+'pedidoVenda.pk');
} else if (cod === "itensList[_clone].itemSequencia") {
element.writeAttribute('id', htmlId+'itemSequencia');
element.writeAttribute('name', htmlId+'itemSequencia');
} else if (cod === "itensList[_clone].deleted") {
element.writeAttribute('id', htmlId+'deleted');
element.writeAttribute('name', htmlId+'deleted');
} else if (cod === "itensList[_clone].new") {
element.writeAttribute('id', htmlId+'new');
element.writeAttribute('name', htmlId+'new');
} else if (cod === "itensList[_clone].produto.pk") {
element.writeAttribute('id', htmlId+'produto.pk');
element.writeAttribute('name', htmlId+'produto.pk');
} else if (cod === "itensList[_clone].quantidade") {
element.writeAttribute('id', htmlId+'quantidade');
element.writeAttribute('name', htmlId+'quantidade');
}
});
clone.writeAttribute('id', 'item'+childCount);
$("childList").insert(clone);
clone.show();
// itemInput.focus();
childCount++;
}
Para se registrar, clique aqui.