Advertisement
Guest User

Untitled

a guest
Dec 14th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function(){
  2.  
  3.     $('#add').click(function(){
  4.         var input = '<div class="field">';
  5.             input += 'Produto:';
  6.             input += '<option value=""></option>';
  7.         <?php while($row = mysql_fetch_assoc($rsProduto)) : ?>
  8.             input += '<option value="<?php echo $row['id_produto']?>"><?php echo $row['nome_produto']?></option>';
  9.         <?php endwhile?>
  10.             input += 'Valor: <input type="text" name="valor[]"  />';
  11.             input += 'Qtd: <input type="text" name="qtd[]"  />';
  12.             input += '<a href="#" class="del">X</a> ';
  13.             input += '</div> ';
  14.  
  15.         $('#campos').append(input);
  16.         return false;
  17.     });
  18.  
  19.     $('.del').live('click', function(){
  20.         $(this).parent().remove();
  21.     });
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement