so the idea is to add a row with an inputfield each time the
inputfield "naam" is filled in.
fore some reason it only adds a new row when i adjust the content of
row 1
any ideas ?

$(function() {

        $(".naam").keyup(function () {
          // json aanroepen
           $.getJSON("producten.js", function(json) {
                                var PrijsGezochteNaam = $(".naam").val();
                                $.each(json.channel.items,function(i,item) {
                                    if (json.channel.items[i].naam == 
PrijsGezochteNaam) {
                                          // index=i; alert(index);
                                          PrijsGezochteNaam= 
json.channel.items[i].prijs;
                                                        
$(".prijs").val(PrijsGezochteNaam);
                                                        var nieuwerij =
                                                         $("<tr class='delijn'>"
                                                                + "<td><input 
type='text' class='naam' /></td>"
                                                                + "<td><input 
type='text' class='aantal' value='1' /></td>"
                                                                + "<td><input 
type='text' class='prijs' disabled='true' /></
td>"
                                                        +"</tr>");
                                        $(nieuwerij).appendTo(".prijslijst 
tbody");
                                            }
                                        });      // end each json
                  });           // end json
     });// end keyup
}); // and document.ready
</script>
</head>
<body>
        <form action="" method="" accept-charset="utf-8">
                <table class="prijslijst" border="1">
                <thead>
                                <th>Naam</th>
                                <th>Aantal</th>
                                <th>Eenheidsprijs</th>
                                <th>Subtotaal</th>
                        </thead>
                        <tbody>
                        <tr class="delijn">
                                <td><input type="text" class="naam" /></td>
                                <td><input type="text" class="aantal" 
value="1"/></td>
                                <td><input type="text" class="prijs" 
disabled="true" /></td>
                                <td><input type="text" class="subtotaal" 
disabled="true" /></
td>
                        </tr>
                        </tbody>

Reply via email to