ola pessoal
segui um post e conseguir fazer para acrescentar linha na tabela
so que preciso colocar um botao para diminuir esta linha
estou tentando usar o remove() do jquery, nao estou conseguindo
segue o script
// JavaScript Document
$(function(){
$('#mais').click(function(){
var next = $('#lista tbody').children('tr').length + 1;
$('#lista tbody').append('<tr id="remover'+next+'">' +
'<td><input type="text" name="item' + next + '" size="70" class="effect" onkeyup="up(this)" /></td>' +
'<td><input type="text" name="quantidade' + next + '" size="5" class="effect" onkeyup="up(this)"/></td>' +
'<td><input type="text" name="uni' + next + '" size="8" class="effect" onkeyup="up(this)" /></td>' +
'<td><input type="text" name="custo' + next + '" size="5" class="effect" onkeyup="up(this)"/></td>' +
//remover linha da tabela
'<td align="center" id="menos'+ next +'"><a href="#" onclick ="$("tr").remove("remover'+next+'");"><img src="resources/images/menos.png" border="0"/></a></td>'+
'</tr>');
$(':hidden').val(next);
return false;
});
$('form').submit(function(){
var parametros = $(this).serialize();
$.get(
$(this).attr('action'),
parametros,
function(data){
$('#resultado').empty().append(data);
},
"html"
)
return false;
});
$('#enviar').click(function(){
$('form').submit();
});
$(':text').live('focus',function(){
$(this).closest('tr').addClass('input-focus');
}).live('blur',function(){
$(this).closest('tr').removeClass();
});
$("#menos").click(function(){
if($("tr").length == 1){
alert("nao e possível remover todas as combos")
}else{
$("tr:last").remove();
}
});
});