I'm trying to create a cart where the user selects the desired pizza and size from a table and the information is displayed in a table format inside a different area (#orderList). I want to make it so that the user can change the quantity and the item and the price changes as well. I think it has something to do with the two different prices in the same row but I'm not sure.
This is currently what I have:
HTML:
<div id="order_column">
    <h2 class="order_column_header">
        Current Order
    </h2>
    <table id="orderList">
    </table>
</div>
<div id="pizzaTableContainer" class="pizzaConatiner container overflowConatiner">
    <table class="menuTable pizza" id="pizzaTable">
        <tr>
            <th class="tableHeader" colspan="500">Standard Pizzas</th>
        </tr>
        <tr>
            <th id="pizzaHeader">Pizza</th>
            <th>Small</th>
            <th>Large</th>
        </tr>
        <tr>
            <td class="desc">Tomato & Cheese</td>
            <td id="spizza1" class="spizza orderChoice">5.50</td>
            <td id="lpizza1" class="lpizza orderChoice">9.75</td>
        </tr>
        <tr>
            <td class="desc">Onions</td>
            <td id="spizza2" class="spizza orderChoice">6.85</td>
            <td id="lpizza2" class="lpizza orderChoice">10.85</td>
        </tr>
        <tr>
            <td class="desc">Peppers</td>
            <td id="spizza3" class="spizza orderChoice">6.85</td>
            <td id="lpizza3" class="lpizza orderChoice">10.85</td>
        </tr>
        ...
        ...
        ...
    </table>
</div>
JQuery:
$('.spizza').click(function () {
    $('#orderList')
    .append($('<tr>')
    .append($('<td>').text("Small " + $(this).parent().children('.desc').text() + " " + $('#pizzaHeader').text()))
    .append($('<td class="qty">')
    .append($('<input type="number" name="quantity" min="1" class="inputField" style="width:30px">').val(1)))
    .append($('<td>').text($(this).parent().children('.spizza').text()))
    .append($('<td class="cross">').html('✖')));
});
$('.lpizza').click( function() {
    $('#orderList')
    .append($('<tr>')
    .append($('<td>').text("Large " + $(this).parent().children('.desc').text() + " " + $('#pizzaHeader').text()))
    .append($('<td class="qty">')
    .append($('<input type="number" name="quantity" min="1" class="inputField" style="width:30px">').val(1)))
    .append($('<td>').text($(this).parent().children('.lpizza').text()))
    .append($('<td class="cross">').html('✖')));
});
$('.inputField').on('change', function () {
    var totalCost = $(this).parent().parent().find('.orderChoice').val() * this.value;
    $('#total').attr('$', totalCost);
});
 
     
     
     
    