SHOW:
|
|
- or go back to the newest paste.
1 | $(function(){ | |
2 | ||
3 | $('#add').click(function(){ | |
4 | var input = '<div class="field">'; | |
5 | - | input += 'Produto:'; |
5 | + | input += 'Produto: <select name="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 += '</select>'; | |
11 | input += 'Valor: <input type="text" name="valor[]" />'; | |
12 | input += 'Qtd: <input type="text" name="qtd[]" />'; | |
13 | input += '<a href="#" class="del">X</a> '; | |
14 | input += '</div> '; | |
15 | ||
16 | $('#campos').append(input); | |
17 | return false; | |
18 | }); | |
19 | ||
20 | $('.del').live('click', function(){ | |
21 | $(this).parent().remove(); | |
22 | }); | |
23 | }); |